Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-31-2011, 05:56 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default Navigation controller in landscape, pop scrolls up

EDIT: i'm sorry, i've copied "0 votes 0 answers 16 views", my mistake! Please, delete it!

Hi everyone!
first of all: i'm italian, so sorry for my bad english!

So... my app uses a navigation controller (created with IB): inside it there is a UIButton connected with an IBAction that does the push in another view.
This view (is called "abc") is created doing this: "File -> New File -> UIViewController Sub Class (with "With XIB for user interface" checked) anche with .m and .h files".

I'm doing the push with this code:

Code:
abc *myview = [[abc alloc] initWithNibName:@"abc" bundle:[NSBundle mainBundle]];
[self pushViewController:myview animated:YES];
of course, in "NavigationController_Class.h" (the class of my navigation controller) i've write this:

Code:
#import "abc.h"
Now, i want to add the landscape support: in "NavigationController_Class.m" and in "abc.m" i've inserted this code:

Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return YES;
}
(i want to support all InterfaceOrientation, so i return YES).

What's the problem?
It works, ok, but when you are seeing "abc" view and you touch the button for pop the view from the stack, the Navigation Controller scrolls not from the right to the left, but from up to down!

Do you know what's the problem?

Thanks!

Last edited by JJSaccolo; 01-31-2011 at 06:18 AM.
JJSaccolo is offline   Reply With Quote
Old 01-31-2011, 11:38 AM   #2 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

Quote:
Originally Posted by JJSaccolo View Post
I'm doing the push with this code:

Code:
abc *myview = [[abc alloc] initWithNibName:@"abc" bundle:[NSBundle mainBundle]];
[self pushViewController:myview animated:YES];
A UIViewController cannot push another view controller. Check the documentation for UIViewController to see what you can do in the sense of presenting Modal View Controllers.

However you mentioned above that you are using a navigationController. In this sense, you need to do

Code:
self.navigationController push.....
Rather than

Code:
 self pushView.....
iSDK is offline   Reply With Quote
Old 02-01-2011, 06:44 AM   #3 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

Quote:
Originally Posted by iSDK View Post
A UIViewController cannot push another view controller. Check the documentation for UIViewController to see what you can do in the sense of presenting Modal View Controllers.
sorry but... i have a Navigation Controller! It can push a UIViewController!
from the documentation "UINavigationController Class Reference": pushViewController:animated: Pushes a view controller onto the receiver’s stack and updates the display.

So i can do it (or no?)

Quote:
Originally Posted by iSDK View Post
However you mentioned above that you are using a navigationController. In this sense, you need to do

Code:
self.navigationController push.....
Rather than

Code:
 self pushView.....
for the same reason, self indicate my navigationController! (it's write in NavigationController_Class.m, non in abc.m)
If i write
Code:
self.navigationController push.....
ti doesn't works!
JJSaccolo is offline   Reply With Quote
Old 02-01-2011, 06:49 AM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

There is very rarely a reason to subclass UINavigationController. Why did you do it?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 02-01-2011, 08:24 AM   #5 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

maybe beacause i'm a newbie
or better... because it's the only way that i know to build a navigation controller!

so, i don't understand: what do you suggest?
a UIViewController with a UINavigationItem that push (how??) another view?
JJSaccolo is offline   Reply With Quote
Old 02-01-2011, 08:57 AM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Navigation controllers contain/manage view controllers, not the other way around.

Make a new project using the navigation template, and observe how it is set up.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 02-01-2011, 11:29 AM   #7 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

did it! and... it's like i did!
the only difference is that the NavigationController load a xib from another file (instead i put a view inside the navigationController).

Also the method for push a viewController is the same:

Code:
 DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
	 [self.navigationController pushViewController:detailViewController animated:YES];
	 [detailViewController release];

Here's a recap
- in "MainWindow_iPhone.xib" i have a NavigationController.
- in the appDelegate i declare this navigationController with his property, then in didFinishLaunchingWithOptions i write this
Code:
[self.window addSubview:navcontroller.view];
and i connect the navigationController with the appDelegate in IB.
- i write the class "navigationcontroller_class" .h and .m
- i write a new file "abc" .h, .m and .xib
- in "navigationcontroller_class.h" i write
Code:
#import "abc.h"
- in "navigationcontroller_class.m" i write
Code:
-(IBAction)go_to_abc{
	abc *myview = [[abc alloc] initWithNibName:@"abc" bundle:[NSBundle mainBundle]];
	[self pushViewController:myview animated:YES];
}
- in "abc.h" this is the interface
Code:
@interface abc : UIViewController {
  ...
  ...
}
Isn't like the Navigation-base Application?
JJSaccolo is offline   Reply With Quote
Old 02-01-2011, 11:32 AM   #8 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Code:
navigationcontroller_class.h
Is this class horribly misnamed, or is it a navigation controller subclass?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 02-01-2011, 11:36 AM   #9 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Code:
navigationcontroller_class.h
Is this class horribly misnamed, or is it a navigation controller subclass?
ahah
in IB i select my navigationController, in the inspector i go to "identity" tab and in "class" i write "navigationcontroller_class".
Then File -> write class files -> navigationcontroller_class.m and .h
JJSaccolo is offline   Reply With Quote
Old 02-01-2011, 11:37 AM   #10 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Post the .h file.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 02-01-2011, 11:40 AM   #11 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Post the .h file.
Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "abc.h"

@interface navigationController_class : UINavigationController {
	//here i have only uibuttons and uilabels
}


-(IBAction)go_to_abc;

@end
JJSaccolo is offline   Reply With Quote
Old 02-01-2011, 11:42 AM   #12 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Ok, so it IS a navigation controller subclass. You shouldn't do that. And yes, this is very different than how the Apple template works.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 02-01-2011, 01:55 PM   #13 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Ok, so it IS a navigation controller subclass. You shouldn't do that. And yes, this is very different than how the Apple template works.
ok, sorry, i see that the Apple template doesn't save the NC subclass, right!
tomorrow i'll try!

Thank you very much
JJSaccolo is offline   Reply With Quote
Old 02-02-2011, 04:40 AM   #14 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 19
JJSaccolo is on a distinguished road
Default

yes, now it works!

thank you
JJSaccolo is offline   Reply With Quote
Reply

Bookmarks

Tags
landscape, navigation controller

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 357
15 members and 342 guests
7twenty7, blasterbr, Clouds, dre, EvilElf, iAppDeveloper, jeroenkeij, jimmyon122, Mah6447, Morrisone, n00b, pungs, Sami Gh, stanny, toon4413
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,121
Posts: 402,900
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:46 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0