03-27-2010, 11:36 AM
#1 (permalink )
Registered Member
Join Date: Mar 2010
Location: Stellenbosch, South Africa
Posts: 88
Second nib in multiview not displaying
I'm a newbie to this.
I have double checked my IB setup and it looks correct. I have followed just about every video on this topic, so I think I am good to go. The navigation worked once through all 10 screens I have. Somehow I must have done something stupid. I have been sitting on this for 3 days...so the problem is likely small, but frustratingly huge.
I have a multiview app, using controllers and buttons to switch between views. The second view (MyDetails) displays as a white screen (blank).
Here is my code until the 2nd view. Perhaps someone can see something I don't see. I would really appreciate some help please!
Happy to send the code to those who really want to help me.
03-27-2010, 11:40 AM
#2 (permalink )
Registered Member
Join Date: Mar 2010
Location: Stellenbosch, South Africa
Posts: 88
My Code
Code:
//
// IfaAppDelegate.h
// Ifa
//
// Created by Marc Tison on 2010/03/21.
// Copyright Marblesharp (Pty) Ltd 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
@class IfaViewController;
@interface IfaAppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UIWindow *window;
IBOutlet IfaViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet IfaViewController *viewController;
@end
//
// IfaAppDelegate.m
// Ifa
//
// Created by Marc Tison on 2010/03/21.
// Copyright Marblesharp (Pty) Ltd 2010. All rights reserved.
//
#import "IfaViewController.h"
@implementation IfaAppDelegate
@synthesize window, viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
- (void)dealloc {
[window release];
[viewController release];
[super dealloc];
}
@end
//
// IfaViewController.h
// Ifa
//
// Created by Marc Tison on 2010/03/21.
// Copyright Marblesharp (Pty) Ltd 2010. All rights reserved.
//
#import "MyDetailsController.h"
@interface IfaViewController : UIViewController {
//Declare 2nd view outlets
IBOutlet MyDetailsController *mydetailsController;
//Declare sound variables
CFURLRef soundFileURLRef;
SystemSoundID soundFileObject;
}
//Set button actions
- (IBAction)goNext:(id)sender;
//Declare properties
@property (nonatomic, retain) IBOutlet MyDetailsController *mydetailsController;
@property (readwrite) CFURLRef soundFileURLRef;
@property (readonly) SystemSoundID soundFileObject;
@end
//
// IfaViewController.m
// Ifa
//
// Created by Marc Tison on 2010/03/21.
// Copyright Marblesharp (Pty) Ltd 2010. All rights reserved.
//
#import "IfaViewController.h"
@implementation IfaViewController
@synthesize mydetailsController;
@synthesize soundFileURLRef, soundFileObject;
// Do additional setup after loading the view
- (void) viewDidLoad {
[super viewDidLoad];
// Get the main bundle for the app
CFBundleRef mainBundle;
mainBundle = CFBundleGetMainBundle ();
// Get the URL to the sound file to play
soundFileURLRef = CFBundleCopyResourceURL (mainBundle,CFSTR ("tap"),CFSTR ("aif"),NULL);
// Create a system sound object representing the sound file
AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject);
}
// Go to next view
- (IBAction)goNext:(id)sender {
//click sound
AudioServicesPlaySystemSound (self.soundFileObject);
//Show My Details Screen
MyDetailsController *nextView = [[MyDetailsController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:nextView animated:YES];
}
// Manage memory
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
}
- (void)dealloc {
[mydetailsController release];
[super dealloc];
}
@end
//
// MyDetailsController.h
// iFA
//
// Created by marcti on 2010/03/10.
// Copyright 2010 Marblesharp 147 (Pty) Ltd. All rights reserved.
//
#import "MyDetailsDatamodel.h"
#import "MyHealthController.h"
@interface MyDetailsController : UIViewController {
//Declare 2nd view outlets
IBOutlet MyHealthController *myhealthController;
IBOutlet UIScrollView *theScroller;
IBOutlet UITextField *NameField;
IBOutlet UITextField *SurnameField;
IBOutlet UITextField *IdNumberField;
IBOutlet UITextField *CellNumberField;
IBOutlet UITextField *EmailAddressField;
//Create space for datamodel
MyDetailsDatamodel *mydetailsDatamodel;
//Declare sound variables
CFURLRef soundFileURLRef;
SystemSoundID soundFileObject;
}
//Set button action
- (IBAction)goBack:(id)sender;
- (IBAction)goNext:(id)sender;
- (IBAction)saveRecord:(id)sender; //Once working, we will remove and we will embed this logic in the goNext method
- (IBAction)closeKeyBoard:(id)sender;
//Delare properties
@property(nonatomic, retain) MyDetailsDatamodel *mydetailsDatamodel;
@property (nonatomic, retain) UITextField *NameField;
@property (nonatomic, retain) UITextField *SurnameField;
@property (nonatomic, retain) UITextField *IdNumberField;
@property (nonatomic, retain) UITextField *CellNumberField;
@property (nonatomic, retain) UITextField *EmailAddressField;
@property (nonatomic, retain) IBOutlet MyHealthController *myhealthController;
@property (nonatomic, retain) UIScrollView *theScroller;
@property (readwrite) CFURLRef soundFileURLRef;
@property (readonly) SystemSoundID soundFileObject;
@end
//
// MyDetailsController.m
// iFA
//
// Created by marcti on 2010/03/10.
// Copyright 2010 Marblesharp 147 (Pty) Ltd. All rights reserved.
//
#import "MyDetailsController.h"
@implementation MyDetailsController
@synthesize myhealthController, theScroller;
@synthesize NameField, SurnameField, IdNumberField, CellNumberField,EmailAddressField;
@synthesize mydetailsDatamodel;
@synthesize soundFileURLRef, soundFileObject;
// Implement viewDidLoad to do additional setup after loading the view
- (void) viewDidLoad {
[super viewDidLoad];
theScroller.contentSize=CGSizeMake(280, 650);
// Get the main bundle for the app
CFBundleRef mainBundle;
mainBundle = CFBundleGetMainBundle ();
// Get the URL to the sound file to play
soundFileURLRef = CFBundleCopyResourceURL (mainBundle,CFSTR ("tap"),CFSTR ("aif"),NULL);
// Create a system sound object representing the sound file
AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject);
}
//Go to next screen
- (IBAction)goNext:(id)sender {
//click sound
AudioServicesPlaySystemSound (self.soundFileObject);
//Go to My Health screen
MyHealthController *nextView = [[MyHealthController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:nextView animated:YES];
}
//Save Record
- (void) saveRecord:(id)sender {
///click sound
AudioServicesPlaySystemSound (self.soundFileObject);
//Assign View fields to data objects
mydetailsDatamodel.Name = NameField.text;
mydetailsDatamodel.Surname = SurnameField.text;
mydetailsDatamodel.IdNumber = IdNumberField.text;
mydetailsDatamodel.CellNumber = CellNumberField.text;
mydetailsDatamodel.EmailAddress = EmailAddressField.text;
/*
IN ORDER TO UPDATE THE REMAINDER OF THE FIELDS NOT VISIBLE ON SCREEN
GENDER:
Assume IdNumber = 6301025031085
create a substring of IdNumberField.text and determine the gender by checking the 7th digit: 5 = "Male"and 0 = "Female" assign variable called gender = "Male"
mydetailsDatamodel.Gender = gender,;
DATE OF BIRTH:
create a substring of the first 6 digits of the IdNumberField.text. Then format it into date "ccyy/mm/dd", where cc = "19
and insert it in the DateofBirth object
assign variable called date = "1963/01/02"
mydetailsDatamodel.DateOfBirth = date;
*/
//Commit the record
[mydetailsDatamodel saveRecordToDatabase];
}
// Go back to previous view
- (IBAction)goBack:(id)sender {
//click sound
AudioServicesPlaySystemSound (self.soundFileObject);
[self dismissModalViewControllerAnimated:YES];
}
// Hide Keyboard
-(IBAction)closeKeyBoard:(id)sender {
[NameField resignFirstResponder];
[SurnameField resignFirstResponder];
[IdNumberField resignFirstResponder];
[CellNumberField resignFirstResponder];
[EmailAddressField resignFirstResponder];
}
// Manage memory
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[theScroller release];
[myhealthController release];
[mydetailsDatamodel release];
[super dealloc];
}
@end
03-29-2010, 05:22 AM
#3 (permalink )
Registered Member
Join Date: Mar 2010
Location: Stellenbosch, South Africa
Posts: 88
I found the problem...stupid...I had the initWithNibName:nil instead of setting it to my actual nib @"" name.
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 351
13 members and 338 guests
akacaj , c2matrix , cgokey , esoteric , GHuebner , givensur , HemiMG , Mirotion22 , mjnafjke , Pudding , SLIC , Sonuye857 , Techgirl-52
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,652
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Sonuye857