Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic UIButton controlls and actions in iphone?
    primarykey
    data
    text
    <p>i am creating an application which includes dynamic pages. actually, i created some dynamic questions and UIButtons (custom checkBox) by checking the responses from the server. my code is here,</p> <pre><code> NSString *response=[ResponseFromServer ObjectAtIndex:0]; if ([comSt compare: @"CheckBoxList"]==NSOrderedSame) { int count=[ResponseFromServer count]; for(int i=0;i&lt;count;i++) { button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.tag=i; [button setFrame:CGRectMake(0.0f, 0.0f, 37, 37)]; [button setCenter:CGPointMake(116.0,p1)]; [button setImage:[UIImage imageNamed:@"uncheck.png"] forState:UIControlStateNormal]; [button setBackgroundColor:[UIColor whiteColor]]; [button addTarget:self action:@selector(checkButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; [self.scrollView addSubview:button]; p1=p1+30; } -(void)checkButtonTapped:(id)sender { int tagVal = [(UIButton*)sender tag]; if (tagVal==0) { NSLog(@"tag = 0"); [button setSelected:YES]; [button setImage:[UIImage imageNamed:@"check.png" forState:UIControlStateSelected]; //not working, button image is not changing } </code></pre> <p>assume i have created 5 dynamic buttons with different tag. i set the image for all those button to uncheck.png first. it works. but when i clicked a specific button and need to change that button image to checked.png, its not working on the button action. i need to change it like checkBox control, how will i access the control of a dynamically created button from a group of buttons?</p> <p>i think u can understand my requirement, thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload