Problem assigning values to membervariables , objective c
i have a view controller like so
@interface Preferences1 : UIViewController<selectedtimedelegate>
{
NSString *Expiration;
NSString *incomingalerts;
NSString *destroyby;
}
in my implementation i am trying to navigate to another screen while assigning the current values to the member variables of the next viewcontroller.
-(IBAction)nextbuttonpressed:(id)sender
{
Preferences2 *addController = [[Preferences2 alloc] initWithNibName:@"Preferences2" bundle:[NSBundle mainBundle]];
addController.Expiration1 = Expiration ;
[self.navigationController pushViewController:addControl开发者_开发知识库ler animated:YES];
[addController release];
}
in Preferences2 viewcontroller i have set the property like so
@property(nonatomic ,retain) NSString *Expiration1;
when i am on the Preferences2 screen i dont see the values, in fact the program crashes while the values are being assigned. can somebody tell me where i am going wrong.
Thanks.
You are missing some where like this:
Are you sure this thing is in Prefernce2,because your code shows something wrong either by typing mistake or the real one.So,check it out.
@interface Preferences1 (Over here it should be Preferences2): UIViewController {
NSString *Expiration; //You need to define this string in Prefernce2 & synthesize in .m
NSString *incomingalerts;
NSString *destroyby;
} @property(nonatomic ,retain) NSString *Expiration1;
精彩评论