three20 and orientation - iphone

I am using three20 for displaying thumbnails. It's working perfectly. But I need to resize the thumbnail. Is it possible to resize the thumbnail and Bool shouldAutorotateToInterfaceOrientation is also not supported
I am implement to check the orientation in viewdidload method
TTDeviceOrientationIsPortrait()
TTDeviceOrientationIsLandscape();
But it is not working in shouldAutorotateToInterfaceOrientation method

I am fixing the issue by using NSNotification for orientation
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(orientationDidChange:)
name:UIDeviceOrientationDidChangeNotification object:nil];
and refer the link by changing size
Change thumbs size in TTThumbsViewController

Related

UINavigationBar height is reducing after re-enteringforeground

My controller main view call
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:YES];
in it's viewDidAppearmethod because the screen must be manually rotated for the user.
Everything works perfectly except when I put the app in background and I re-enter foreground on this screen: Then the navigationBar's height become 32px.
If I comment the setStatusBarOrientation call, then no problem.
I've logged the navigationBar height in didEnterForeground method (after the super call), but it tells 44px. So I guess it would be resized after.
So I would like to know :
If there was a way to prevent the navigationBar to be resized
If no, what other callback method would come after the didEnterForeground one (viewWill/DidAppear does'nt)
Thanks !
After 4 months, I finally found a partial solution !
If no, what other callback method would come after the didEnterForeground one (viewWill/DidAppear does'nt)
I found a good callback when a viewController (not app delegate) is re-entering foreground. With NSnotificationCenter
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
don't forget to remove
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];

willRotateToInterfaceOrientation not getting called

I have an issue when playing video while using the c "willRotateToInterfaceOrientation" function. Initially, I have my main view set on the landscape mode. The video is playing but then I tried to rotate it to portrait mode my project doesn't call the "willRotateToInterfaceOrientation" but when I tried to rotate it back to the landscapeleft mode and then rotate back again to the portrait mode it's just the time the "willRotateToInterfaceOrientation" is called. can anyone please help me? thanks
Try this instead of implementing code in willRotateToInterfaceOrientation.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
NSNotificationCenter* notifCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
selector:#selector(orientationChanged)
name:UIDeviceOrientationDidChangeNotification
object:nil];
Add the following method
-(void) orientationChanged
{
//Copy code from your willRotateToInterfaceOrientation method here.
}

Iphone web application problem on iphone keyboard open

I have a problem of layout in view my website on iphone/Ipad, when the iphone keyboard open The whole website moved to top due to which user will not be able to view the top content while the keyboard is open. When keyboard is close the website will be back to its original position.
Implement the below nottification methods in init method of the controller showing your website:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWasHidden:)
name:UIKeyboardDidHideNotification object:nil];
try setting the frame of your website in the corresponding notification methods (keyboardWasShown,keyboardWasHidden). Eg:- Say your webSiteView is the view disaplying your website and x,y are the coordinates of the view when keyboard is not visible. When the keyBoard is shown, set the frame of the webSiteView with the new x1 and y1 coordinates that will show the view the way you want.
- (void)keyboardWasShown: (id)sender {
[webSiteView setFrame:CGRectMake(x1,y1,w,h)];
}
- (void)keyboardWasHidden: (id)sender {
[webSiteView setFrame:CGRectMake(x,y,w,h)];
}
Also if you are not able to see the entire webSite, try adding your webSiteView into a scrollView and set the frame of the ScrollView in the notification methods.

Which method will be called when the iOS device turn into Landscape mode?

I know that I can return YES to support Landscape mode in shouldAutorotateToInterfaceOrientation. But I would like to display a new view, when the user turn the device into landscape mode, how can I do so? thank you.
Observer this event UIDeviceOrientationDidChangeNotification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(orientationDidChange:)
name:UIDeviceOrientationDidChangeNotification object:nil];
A useful technique for just this case is, to present a new modal view controller with a "fade" transition from your current view. You can do this in reaction to UIDeviceOrientationDidChangeNotification as mentioned previously by Aaron.
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

Change view layout with orientation

I am working on an application where I want the view to change quite a lot when the device is rotated. I know that in Interface Builder it is possible to change the orientation and set up the layout there, however when I then rotate it to portrait, the view is the same as for the landscape. Is there a way to set up the two views independently, perhaps using two nibs?
Cheers,
JP
If you're after switching view controllers on orientation changes, like when the iPod app shows it's coverflow view, the following post will help:
http://rndnext.blogspot.com/2009_06_01_archive.html
I don't know if you can do it in IB, but I know you can do it in code. You need to observe the UIDeviceOrientationDidChangeNotification Notification:
(in viewDidLoad...)
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:#selector(updateViewOnRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
....
-(void) updateViewOnRotate:(NSNotification *notification) {
// update the views
}