TTAlertView misrenders in landscape (at least for iPad & Simulator 3.2)

68 views
Skip to first unread message

Marshall Rose

unread,
Jun 30, 2010, 2:03:43 AM6/30/10
to Three20
using the main three20 branch from github:

if you navigate to a TTAlertViewController while landscape-oriented,
the rendering is bizarre: the background window is in the portrait
orientation (although the buttons would be correctly positioned if the
background window was correctly positioned).

no such problem exists for TTActionSheetController, and a cursory
examination of all things TTAlertView* and TTActionSheet* in the
source do not suggest any different handling. this makes me wonder
whether this is actually a UIKit issue (although nothing on google
shows up).

steps to repeat are below. if i'm doing something obviously wrong,
please educate.

enjoy!

/mtr

to repeat:

1. in applicationDidFinishLaunching, add this:

[map from:@"tt://avc1" toViewController:[AVC1 class]];
[map from:@"tt://avc2" toModalViewController:[AVC2 class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://
avc1"]];

2. put this in your project:

@interface AVC1 : TTTableViewController
@end

@interface AVC2 : TTAlertViewController
@end

@implementation AVC1
- (id)init {
if (self = [super init]) {
switch ([[UIDevice currentDevice] orientation]) {
case UIDeviceOrientationLandscapeLeft:
case UIDeviceOrientationLandscapeRight:
self.title = @"Please tap below.";
break;

default:
self.title = @"Please place device in landscape
orientation before tapping below!";
break;
}

self.dataSource = [TTListDataSource dataSourceWithObjects:
[TTTableTextItem itemWithText:@"Tap
here..." URL:@"tt://avc2"],
nil];
}

return self;
}
@end

@implementation AVC2
- (id)init {
NSString *title;
NSString *message;
switch ([[UIDevice currentDevice] orientation]) {
case UIDeviceOrientationLandscapeLeft:
case UIDeviceOrientationLandscapeRight:
title = @"Not expected";
message = @"Indeed.";
break;

default:
title = @"Off topic";
message = @"Notice how the table cell remains highlighted
after this TTAlertView is dismissed.";
break;
}

if (self = [super initWithTitle:title message:message]) {
[self addCancelButtonWithTitle:@"Dismiss" URL:nil];
}
return self;
}
@end

Romano

unread,
May 22, 2012, 11:00:31 AM5/22/12
to thr...@googlegroups.com
Hi Marshall, 

You posted this message a while ago, don't know if you're still interested by the solution but I answer anyway so that if anyone encounters the same problem he can find the solution here.

Just got the same issue, I solved it by writing the category :

@implementation TTAlertViewController (iPadRotation)


///////////////////////////////////////////////////////////////////////////////////////////////////

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

{

return NO;

}


@end


Regards, Romano

Reply all
Reply to author
Forward
0 new messages