Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-28-2011, 05:59 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 15
amilmac is on a distinguished road
Unhappy UIScrollView with UIButton(s) App crash

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!
amilmac is offline   Reply With Quote
Old 05-28-2011, 07:00 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

what error exactly? post also toggleView.

when freeze, after tapping or immediately?
__________________
dany_dev is offline   Reply With Quote
Old 05-28-2011, 10:13 AM   #3 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 15
amilmac is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
what error exactly? post also toggleView.

when freeze, after tapping or immediately?
Hi dany,

What do you refer with toggleView? Maybe IBAction on button to load the View that contains the scroll?

Debug show a :

int retVal = UIApplicationMain(argc, argv, nil, nil); // Thread 1: Program received signal "EXC_BAD_ACCESS"

And happen when i atempt to click or move the scrollView.

Thank you!
amilmac is offline   Reply With Quote
Old 05-28-2011, 10:39 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Code:
    [homeButton2 addTarget:self action:@selector(toggleView) forControlEvents:UIControlEventTouchUpInside];
you should have a selector called in this mode....
__________________
dany_dev is offline   Reply With Quote
Old 05-28-2011, 12:54 PM   #5 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 15
amilmac is on a distinguished road
Default

Yes Dany, as you can see in the code i´ve posted i am adding code like you write (with the toggleView)
amilmac is offline   Reply With Quote
Old 05-29-2011, 05:37 AM   #6 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 15
amilmac is on a distinguished road
Default

Could you please write a little code as example for give me more light with code you refer?

Thank you!
amilmac is offline   Reply With Quote
Old 05-29-2011, 08:31 AM   #7 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

i mean that in your code you have something like
Code:
-(void)toggleView{

}
post the code, maybe the problem is here.
__________________
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Tags
uibutton, uiscrollview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 346
6 members and 340 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:14 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0