it works perfectly fine.
but I have another button on the nib file named "Kong" that i want to use to go back.
I decided not to use a navigation controller because it doesnt let me change the colour of the navigation bar.
When ever i click on the button on the view of Kong, the app restarts.
I tried connecting the button to an IBAction method in the app delegate or the view controller. Even if i dont put any code in the method it restarts.
This is my first post and i just started coding this week so i'm a noob.
i have watched many. But perhaps not the right ones. Most of them were for navigation based applications but i found one on youtube for tab bar based but it was with a navigation controller which i dont want to use because of the colour of the navigation bar.
At this point its not the navigation i'm worried about. Its just that the button on my new view will make my app restart even with no code in it. Any ideas on where i should put the -(IBAction) method? maybe thats the problem.
"I decided not to use a navigation controller because it doesnt let me change the colour of the navigation bar."
Err...UINavigationBar does in fact have a tintColor property, which allows you to set its color. You can do this in IB by selecting the navigation bar and using the 1st inspector.
__________________
If I have helped you, please consider donating. I use PayPal. It would mean a lot to me!
IphoneSdk :
i entered this in my viewController.m
-(IBAction)gotonext
{
viewController *ViewController = [[viewController alloc] initWithNibName:@"Kong" bundle:nil];
[self presentModalViewController:ViewController animated:YES];
[ViewController release];
}
and when i clicked on my button, my app restarted.
musicwind95:
i know i can change it of colour.. and regularly it lets me but when theres a navigation controller involve i no longer have that option in inspector
never mind! i put the code and it doesn't restart my app.... but the view stays the same and it doesn't do anything.
I dont know what I am doing wrong :S
maybe this will clear things up
the problem is when i connect a button that is on my Subview to a method.
When ever i connect that button to a method in viewController or the AppDelegate and press it, the app restarts
it might do this because its on the subview?
maybe this will clear things up
the problem is when i connect a button that is on my Subview to a method.
When ever i connect that button to a method in viewController or the AppDelegate and press it, the app restarts
it might do this because its on the subview?
Can you post the code you are using in both view controllers?
Presenting a modal view controller is really only calling a new view rather than a sub view. Therefore if your app is showing a single modal view controller, calling [self dismissModalViewController:YES] will remove it from view.
Conor,
theres no code in my view Controllers... only what was already there.
all my methods are in the app Delegate since I am referencing to window that is declared in the apps delegate .h file
i am referencing window in this method
dethmaShine, wouldn't it be an IBAction since i need to connect it to a button?
Also, I wouldn't go against anyone but modalviewcontrollers are used to pass in data and other interactions.
If you just need to move on to a different view altogether and work in that workspace, you must subview it. ModalViewControllers are easy to use but they do not give the right indication of what you are trying to display.
Also, I would suggest you making a viewBased application and going for a similar approach just to build up some confidence.
Switching is pretty complex. IMO, it takes most of your understand of how/when to use simple view/navigation/tab bar controllers.
dethmaShine,
i put the method in my viewController and connected my button to it.
But when i click on the button it restarts the app.
Il tell you guys exactly what im doing do you can tell me what i'm doing wrong.
I have a MainWindow with a Tab Controller.
One of the tabs has a button on it that links to a method in my AppDelegate.
This method is:
This successfully brings me to that view.
View1 has a navigation bar with a normal "bar button item" on it
that bar button is connected to a method in viewController
this method is:
-(IBAction)viewback{
[self.view removeFromSuperView];
}
dethmaShine,
i put the method in my viewController and connected my button to it.
But when i click on the button it restarts the app.
Il tell you guys exactly what im doing do you can tell me what i'm doing wrong.
I have a MainWindow with a Tab Controller.
One of the tabs has a button on it that links to a method in my AppDelegate.
This method is:
This successfully brings me to that view.
View1 has a navigation bar with a normal "bar button item" on it
that bar button is connected to a method in viewController
this method is:
-(IBAction)viewback{
[self.view removeFromSuperView];
}
It's hard to understand how you have placed your views. It would be great if you could attach the project in your next post.
here i made a similar app with nothing on it except the essentials.
even then i couldnt include the folder build
hopefully you guys can still see what i did