Lazy-load UIScrollView with UIView containing UIButtons?

Up vote 0 down vote favorite share g+ share fb share tw.

I have an app where I'm lazy-loading the contents of a Scroll View with a series of UIViews from the same xib. Here's the viewDidLoad: - (void)viewDidLoad { super viewDidLoad; numberOfPages = 3; // view controllers are created lazily // in the meantime, load the array with placeholders // which will be replaced on demand NSMutableArray *controllers = NSMutableArray alloc init; for (unsigned I = 0; I = numberOfPages) return; // replace the placeholder if necessary MyViewController *controller = viewControllers objectAtIndex:page; if ((NSNull *)controller == NSNull null) { controller = MyViewController alloc initWithPageNumber:page; controller. ThisItem = contentsArray objectAtIndex:page; viewControllers replaceObjectAtIndex:page withObject:controller; controller release; } // add the controller's view to the scroll view if (nil == controller.view.

Superview) { CGRect frame = CGRectMake(0, 0, 320, 300); frame.origin. X = 0; frame.origin. Y = 300 * page; controller.view.

Frame = frame; scrollView addSubview:controller. View; } } Now the MyViewController UIViewController has a button (linked in the Interface Builder) which should open a browser window for each view controller: myButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside; myButton setTag:pageNumber; myButton setTitle:thisItem objectForKey:@"buttonName" forState:UIControlStateNormal; Here's the action: - (IBAction)buttonAction:(id)sender { NSLog(@"%d",sender tag); NSURL *url1 = NSURL URLWithString:thisItem objectForKey:@"url"; UIApplication sharedApplication openURL:url1; } The problem I'm having is only the final button loaded is actually active. I can see all the other buttons and they have the correct title, but none of them accept touches (they do not highlight blue).

Ios uiscrollview uibutton link|improve this question asked Nov 23 '11 at 19:02Nick11.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions