Hi I was just going through the controls called tableview and uiswitch i added the uiswitch control inside the table view cell with the help of the code given below
cell.accessoryView = objswitch;
Now what i wanted is that my tableviewcell text must change to on or off as per the value change event of the switch so i wrote a function which looks like this
-(void)changetext
{
if(objswitch.on)
{
str = @"ON";
}
else
{
str = @"Off";
}
}
where str is an object of NSString class...
and i have wrote a block of code in the init method
[objswitch addTarget:self action:@selector(changetext) forControlEvents:UIControlEventValueChanged];
and in the cell for row at index path function i have done this
cell.text = str;
but still i dont know what i am doing wrong the table text is not changing, please help me out
Thank you...