This is my first post on SO, so hi!
I'm new to Xcode and Obj-C too so don't be too harsh.
I am following the demo from Standford University youtube.com/watch?v=L-FK1TrpUng For some reason i've hit an error. Rather than starting from scratch i'd prefer to figure out where I have gone wrong.
Ok so here goes.
I have two view controllers and i'm currently learning about push and pop.
My first view controllers (firstViewController.h) header:
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
}
- (IBAction)pushViewController:(id)sender;
@end
Then initially this was set up in the implementation file (firstViewController.m), like this
#import "firstViewController.h"
@implementation FirstViewController
- (IBAction)pushViewController:(id)sender{
}
At this point with IB I ctrl dragged from 'File's owner' to a 'UIButton' and connected 'pushViewController'
However, somewhere along the way I received somekind of error, which I ignored.
Now I have my second view controller added into my firstViewController.m like this;
#import "firstViewController.h"
#import "secondViewController.h"
@implementation FirstViewController
- (IBAction)pushViewController:(id)sender{
SecondViewController *secondViewController = [[SecondViewController alloc] init];
secondViewController.title = @"Second";
[self.navigationController pushViewController:secondViewController animated:YES];
[secondViewController release];
}
The error that I received previously seemed to somehow stop me from ctrl dragging from a textLabel in my secondViewController nib
(secondeViewController.h)
#import "firstViewController.h"
#import "secondViewController.h"
@implementation FirstViewController
- (IBAction)pushViewController:(id)sender{
SecondViewController *secondViewController = [[SecondViewController alloc] init];
secondViewController.title = @"Second";
[self.navigationController pushViewController:secondViewController animated:YES];
[secondViewController release];
}
So i removed the references from my original UIButton via right clicking on it in the firstViewController.xib.
Now I cannot recreate the link from 'File's Owner' to the 'UIButtons', 'pushViewController' outlet (is it an outlet or is it an action?) nor create the link in my secondViewControllers nib from 'File's Owner' to the 'UILabel'.
Any help?
Project files here if anyone is interested. http://zer-o-one.com/upload/files/PushPop.zip
Much appreciated.