Hi friends,
In a View Based App, i´ve implemented in one view a scroll (UIScrollView) in part of view and i have added buttons, but for any reason, when i build project and go to the view with the scroll and buttons, app crash or freeze, here is the part of code where i implement the scroll and the buttons:
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIImageView *tempImageView=[[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"back.png"]];
self.imageView = tempImageView;
//scrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height);
scrollView.contentSize = CGSizeMake(320,600);
scrollView.maximumZoomScale = 4.0;
scrollView.minimumZoomScale = 0.75;
scrollView.clipsToBounds = YES;
scrollView.delegate = self;
[scrollView addSubview:imageView];
[tempImageView release];
//UIButton *homeButton = [[UIButton alloc] initWithFrame:CGRectMake(155.0, 217.0, 72.0, 67.0)];
UIButton *homeButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 84, 84)];
[homeButton setTitle:@"" forState:UIControlStateNormal];
[homeButton setImage:[UIImage imageNamed:@"imagebutton1.png"] forState:UIControlStateNormal];
[homeButton addTarget:self action:@selector(toggleView) forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:homeButton];
[homeButton release];
UIButton *homeButton2 = [[UIButton alloc] initWithFrame:CGRectMake(100, 10, 84, 84)];
[homeButton2 setTitle:@"" forState:UIControlStateNormal];
[homeButton2 setImage:[UIImage imageNamed:@"imagebutton2.png"] forState:UIControlStateNormal];
[homeButton2 addTarget:self action:@selector(toggleView) forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:homeButton2];
[homeButton2 release];
// Follow adding rest UIButtons (about 20)
}
Thanks in advance for all help and suggestions!! All help will be hight appreciated!