Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 2, 2011, 04:00 PM   #1
timbojill
macrumors member
 
Join Date: May 2011
How do you turn a Tab Bar Application into a View-Based Application...

How do you turn a Tab Bar Application into a View-Based Application. I have a Tab Bar Application already submitted into the app. View my blog and look at the learning Center. Instead of Tabs I want one view as my main view and that from the main view have buttons that switch to and from other xib files.
timbojill is offline   0 Reply With Quote
Old Jun 2, 2011, 10:12 PM   #2
nickculbertson
macrumors regular
 
Join Date: Nov 2010
Location: Nashville, TN
Just delete or ignore your tab bar button functions and create UIButtons to navigate your views.
Nick
__________________
My App Blog --->
nickculbertson is offline   0 Reply With Quote
Old Jun 3, 2011, 07:39 AM   #3
timbojill
Thread Starter
macrumors member
 
Join Date: May 2011
I ignored the Tab Bar and added buttons to the main view. But what is the code to have the xib files connected.
timbojill is offline   0 Reply With Quote
Old Jun 3, 2011, 08:04 AM   #4
nickculbertson
macrumors regular
 
Join Date: Nov 2010
Location: Nashville, TN
Code:
-(IBAction)changeSecondView{
SecondView *views = [[SecondView alloc] initWithNibName:Nil bundle:nil];
	[self presentModalViewController:views animated:NO];
}
You will also want to create a SecondView .h and .m file by right clicking your Class folder and selecting Add > New File. Add a UIViewController subclass (uncheck the add xib if you already have one). click Next. Set the file name to SecondView.m and make sure the Also create "SecondView.h" box is checked. Then at the top of your FirstViewController.m add
Code:
#import "SecondView.h"
Nick
__________________
My App Blog --->
nickculbertson is offline   0 Reply With Quote
Old Jun 3, 2011, 08:39 AM   #5
timbojill
Thread Starter
macrumors member
 
Join Date: May 2011
Quote:
Originally Posted by nickculbertson View Post
Code:
-(IBAction)changeSecondView{
SecondView *views = [[SecondView alloc] initWithNibName:Nil bundle:nil];
	[self presentModalViewController:views animated:NO];
}
You will also want to create a SecondView .h and .m file by right clicking your Class folder and selecting Add > New File. Add a UIViewController subclass (uncheck the add xib if you already have one). click Next. Set the file name to SecondView.m and make sure the Also create "SecondView.h" box is checked. Then at the top of your FirstViewController.m add
Code:
#import "SecondView.h"
Nick
I tried to use a .h and .m file I already had. The name is 2nd.h and 2nd.m.

So should it be:
Code:
2nd *views = [[2nd alloc] initWithNibName:Nil bundle:nil];
	[self presentModalViewController:views animated:NO];
?

Last edited by dejo; Jun 3, 2011 at 10:33 AM. Reason: Fixed code tags.
timbojill is offline   0 Reply With Quote
Old Jun 3, 2011, 09:06 AM   #6
nickculbertson
macrumors regular
 
Join Date: Nov 2010
Location: Nashville, TN
You will be loading the xib file this way. So if your xib name is "2nd" then your code is correct. the code written in your 2nd.h and .m can be linked to your 2nd.xib (or any xib for that matter) by opening interface builder -> select your files owner -> select the last tab (i) on the identity inspector window -> change class to 2nd.

Nick
__________________
My App Blog --->
nickculbertson is offline   0 Reply With Quote
Old Jun 3, 2011, 09:16 AM   #7
timbojill
Thread Starter
macrumors member
 
Join Date: May 2011
http://www.mediafire.com/?iby0z3obz9fj1ah. Can you take a look at my program and she what I am doing wrong.
timbojill is offline   0 Reply With Quote
Old Jun 3, 2011, 09:52 AM   #8
nickculbertson
macrumors regular
 
Join Date: Nov 2010
Location: Nashville, TN
The application looks pretty messy. I believe the reason it is crashing is because you are trying to change the view from a UIView, not a UIViewController. I'd recommend starting fresh with a new view based app. It shouldn't take long since all you have now are a few buttons linked to functions you are not using. In the view based app add the .h and .m files like I said but check the box to include the xib.
Good Luck,
Nick
__________________
My App Blog --->
nickculbertson is offline   0 Reply With Quote
Old Jun 3, 2011, 10:32 AM   #9
timbojill
Thread Starter
macrumors member
 
Join Date: May 2011
Quote:
Originally Posted by nickculbertson View Post
The application looks pretty messy. I believe the reason it is crashing is because you are trying to change the view from a UIView, not a UIViewController. I'd recommend starting fresh with a new view based app. It shouldn't take long since all you have now are a few buttons linked to functions you are not using. In the view based app add the .h and .m files like I said but check the box to include the xib.
Good Luck,
Nick
I already started from the beginning. I took an example of a view app and try to modify it. If you ran the program the first button works. I just need to find a way to add the other buttons to link to the other .h files and xib files I have.

EDIT:

In the example I used he added all the xib's to the main xib. I want to uses other xibs I imported.

EDIT 2:

http://www.mediafire.com/?swbm2ksyefdzzm3 nick I hope you still around. I started from the beginning with a new view-based project. In the LC4Viewcontroller.m I get an error in the IBAction that calls the first views from the main view.

Code:
- (IBAction)view2 {
    [self addSubview:Letter];
}
The error is expected expression before letter. Can anyone help me out.

EDIT 3:

Can someone add a third view called view3 and connect it for me. When I did it it said view3 undecleared. I don't know why I am having so much trouble.

http://www.esnips.com/doc/66bb2e0c-1...69b13db895/new

Last edited by dejo; Jun 3, 2011 at 12:11 PM. Reason: Consecutive posts. Please use edit feature.
timbojill is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How do you incorporate buttons/tabs into a project Jacksonworld iPhone/iPad Programming 0 Jan 17, 2010 06:25 PM
how do you turn off the chime when the mbp turns on? Junkie2 MacBook Pro 6 Apr 3, 2009 11:44 AM
How do i make a full screen application into a normal window? olliestockton Mac Applications and Mac App Store 1 Apr 20, 2008 01:02 PM
How do you turn your Mac into Vista? brian9271 Mac Basics and Help 48 Feb 12, 2008 02:22 PM
How do you turn a 269 phone into a brick? Jarcrew iPhone 1 Nov 1, 2007 06:32 PM


All times are GMT -5. The time now is 02:08 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC