|Jul 31, 2010, 08:30 PM||#1|
Newbie question iPad views
I want to create an iPad app that responds to rotation, but shows a different arrangement of buttons/etc in each orientation.
I figured out how to respond to the rotation itself, but how do I tell the view controller or window to change to the second view after rotation?
Just trying to load the second Xib seems to cause a crash.
Last edited by pinsrw; Aug 1, 2010 at 07:54 AM.
|Aug 1, 2010, 12:09 PM||#2|
|Aug 1, 2010, 12:32 PM||#3|
I think it all depends what you are doing and how much things 'change'. I assume you want to add extra controls, etc or have a whole lot of stuff change around.
In which case, you could have everything ready and handle it manually by hiding/showing the controls when rotation is detected as well as repositioning using CGRectMake to position your elements.
However, if you really do have vastly different views with extra functionality, you may well be better off creating both as UIViewControllers and adding each one to the main view controller, depending on the rotation.
again, I'm fairly new to all this as well, so there may well be a slicker way, but i tend to use a combination of the above, depending on how much I actually change.
|Aug 1, 2010, 09:28 PM||#4|
#1 0x96598ee8 in kill$UNIX2003
#2 0x9662b62d in raise
#3 0x966416e4 in abort
#4 0x917a1fda in __gnu_cxx::__verbose_terminate_handler
#5 0x0294c61c in _objc_terminate
#6 0x917a017a in __cxxabiv1::__terminate
#7 0x917a01ba in std::terminate
#8 0x917a02b8 in __cxa_throw
#9 0x0294c3d8 in objc_exception_throw
#10 0x02833a5b in -[NSObject doesNotRecognizeSelector:]
#11 0x027b0676 in ___forwarding___
#12 0x027af9f2 in __forwarding_prep_0___
#13 0x0000257e in -[iPadTestViewController receivedRotate:] at iPadTestViewController.m:27
#14 0x0001a586 in _nsnote_callback
#15 0x0279a165 in _CFXNotificationPostNotification
#16 0x000112ca in -[NSNotificationCenter postNotificationNamebject:userInfo:]
#17 0x0048517c in -[UIDevice setOrientation:animated:]
#18 0x002c5852 in -[UIApplication handleEvent:withNewEvent:]
#19 0x002c04f7 in -[UIApplication sendEvent:]
#20 0x002c81d8 in _UIApplicationHandleEvent
#21 0x030c517c in PurpleEventCallback
#22 0x0278189c in CFRunLoopRunSpecific
#23 0x027808a8 in CFRunLoopRunInMode
#24 0x030c389d in GSEventRunModal
#25 0x030c3962 in GSEventRun
#26 0x002c6372 in UIApplicationMain
#27 0x0000229c in main at main.m:14
I loaded the 2nd view in receivedRotate thus:
UIView *view2 = [[UIView alloc] initWithNibName: @"Landscape" bundle:nil]; [self.view addSubview: view2];
|Aug 2, 2010, 11:42 AM||#5|
Xcode probably flagged a warning about this when it compiled your code. Unless you have a good reason to justify ignoring a compile-time warning, don't.
Last edited by dejo; Aug 2, 2010 at 11:50 AM.
|Aug 4, 2010, 03:47 PM||#6|
In fact, UITableView ends up looking like a mess. Either the lines are missing or the dimensions are wrong. It's just bad.
Last edited by pinsrw; Aug 5, 2010 at 12:14 PM.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|ipad mini users views on Nexus 7 (2013)||hbksabhi||Alternatives to iOS and iOS Devices||27||Sep 9, 2013 04:24 AM|
|iTunes 11 Views Question||xSinghx||Mac Applications and Mac App Store||0||Nov 29, 2012 03:35 PM|
|Newbie question re iPad 2 and old iPod touch?||horvie||iPad||0||Sep 24, 2012 10:28 AM|
All times are GMT -5. The time now is 07:09 AM.