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 01-10-2010, 06:22 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 19
pcgeek is on a distinguished road
Default Picker App Crashes When Switching Views

I'm working on an app that is setup as follows:
  • Tab Bar Controller with four tabs
  • All four tabs are setup as navigation controllers
  • The tab bar and navigation controller are programatically setup in the app delegate.
  • Three of the four tabs utilize table views (hence the navigation)
  • The fourth tab is setup just as a view with a picker with labels (also is a navigation controller) and an 'info' button in the top right of the navigation pane.

The 'info' button is setup as follows:

Code:
- (void)viewDidLoad 
{
	[super viewDidLoad];
	
	// Create an info page button
	UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
	[infoButton addTarget:self action:@selector(modalViewAction:) forControlEvents:UIControlEventTouchUpInside];
	UIBarButtonItem *modalButton = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
	[self.navigationItem setRightBarButtonItem:modalButton animated:YES];
	[modalButton release];
	[infoButton release];
	[self updateLabels];
}
// Here is the selector action

Code:
- (IBAction)modalViewAction:(id)sender
{
	if (self.myInfoViewController == nil)

        self.myInfoViewController = [[[MyInfoViewController alloc] initWithNibName:@"MyInfoView" bundle:nil] autorelease];
	
	[self.navigationController presentModalViewController:self.myMotorStartersInfoViewController animated:YES];
}
In the viewDidLoad I setup the arrays.

In the 'second view' that the info button navigates to I using the following with the 'done' button.

Code:
- (IBAction)dismissAction:(id)sender
{
	[self.parentViewController dismissModalViewControllerAnimated:YES];
}
The issue I am having is the following:

Scenario 1

I run the app, go to the tab with the picker and change the picker values to update the labels on the view. This works ok. If I select the info button, the app crashes.

The error I am getting is:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (13897984) beyond bounds (2)'

Scenario 2

I select the 'info' button in this tab, it opens to another view and I select the 'okay' button to go back to the picker view. Once I go back to the picker view the app crashes after moving the picker wheels. I have the picker setup to update on view did appear like this.

Code:
- (void)viewDidAppear:(BOOL)animated 
{
	// These are the default values for the picker when the app starts
	[myPicker selectRow:0 inComponent:0 animated:YES];
	[myPicker selectRow:0 inComponent:0 animated:YES];
}
Do you think this is an issue with releasing objects, etc?
pcgeek is offline   Reply With Quote
Reply

Bookmarks

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: 321
12 members and 309 guests
2Apps1Day, akacaj, Domele, Duncan C, GraffitiCircus, michelle, NetGuru, NSString, Paul Slocum, Sloshmonster, soohyun, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,885
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

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