I am trying to load a UIView with multiple data. The problem is data is not displays in first load but loads it in subsequent clicks. Can you help me trace the problem.
FirstViewController.h
#import <UIKit/UIKit.h>
@class SecondViewController;
@interface FirstViewController : UIViewController {
IBOutlet SecondViewController *mySecondViewController;
IBOutlet UIImageView *myimage1;
IBOutlet UIImageView *myimage2;
IBOutlet UILabel *mylabel1;
IBOutlet UILabel *mylabel2;
}
@property (nonatomic, retain) IBOutlet SecondViewController *mySecondViewController;
@property (nonatomic, retain) IBOutlet UIImageView *myimage1;
@property (nonatomic, retain) IBOutlet UIImageView *myimage2;
@property (nonatomic, retain) IBOutlet UILabel *mylabel1;
@property (nonatomic, retain) IBOutlet UILabel *mylabel2;
- (IBAction)bringNextView:(id)sender;
- (IBAction)bringNextView2: (id)sender;
@end
FirstViewController.m
#import "FirstViewController.h"
#import "SecondViewController.h"
@implementation FirstViewController
@synthesize mySecondViewController,myimage1, myimage2, mylabel1, mylabel2;
- (IBAction)bringNextView:(id)sender {
mySecondViewController.name.text = @"Paul";
mySecondViewController.myimageview.image = [UIImage imageNamed:@"Paul.png"];
mySecondViewController.statmsg.text = @"Doing iPhone Development";
[[self navigationController] pushViewController:mySecondViewController animated:YES];
}
SecondViewController.m
#import "SecondViewController.h"
@implementation SecondViewController
@synthesize myimageview, name, statmsg
- (void)viewDidLoad {
[self setTitle:@"Details"];
[super viewDidLoad];
}
Properties are not coming for the first time. But are displays after returning from view and then loading view again.
I am loading SecondViewController from FirstViewController.