ios - how can i save the name of UIButton in string? -


i have button named

uibutton *button1; 

how can save 'button1' in string? or able save or not?

check

import

#import "objc/runtime.h"   -(ibaction)btnitemlistclicked:(id)sender  { uibutton *btn=sender; nsstring *name = nil;  uint32_t ivarcount; ivar *ivars = class_copyivarlist([self class], &ivarcount);  if(ivars) {     for(uint32_t i=0; i<ivarcount; i++)     {         ivar ivar = ivars[i];          id pointer = object_getivar(self, ivar);         if(pointer == sender)         {             name = [nsstring stringwithutf8string:ivar_getname(ivar)];             break;         }     }      free(ivars); } nslog(@"%@", name); } 

output is:

printing description of name:

btnconferencecall

check sample demo

buttondemo


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -