this driving me nuts, because know had working 1 time , changed try else , can't go way had it.
here have, i'll try keep simple. have 1 xib 3 different views. 1 main view, other 2 "info" panels have data laid out either in portrait or landscape. there button on main bring info page. , of course button on info pages.
in main.h have
i setup upon initialization.code:@interface maincontroller : uiviewcontroller { uiview *infoland; uiview *infoport; boolean landscape; boolean ininfo; }
have button press event :
i have didrotate event trappedcode:- (ibaction)pbinfo:(id)sender { { if (landscape) [[self view] addsubview:infoland]; else [[self view] addsubview:infoport]; ininfo = true; }
i impression i'm doing fundamentally wrong, because keeps adding sub views. looks working, button displays garbled view, of whatever last displayed.code:- (void) didrotate:(nsnotification *)notification { if (landscape) { [infoport removefromsuperview]; // ** update 2 [[self view] addsubview:infoland]; } else { [infoland removefromsuperview]; // ** update 2 [[self view] addsubview:infoport]; } } - (ibaction)pbinfoback:(id)sender { if (landscape) { [infoport removefromsuperview]; // ** update 2 [infoland removefromsuperview]; } else { [infoland removefromsuperview]; // ** update 2 [infoport removefromsuperview]; } }
did make it, @ 1 time, add 2 sub when info button clicked , bring correct sub view front. when landscape view displayed in upper half of screen. think because added when not in landscape mode?
have idea i'm doing wrong? i'd working asap.i've been dragging app along long enough.
update, additional information
launch app, while in portrait mode, touch info. if touch button while in portrait goes main screen. perfect. if start in portrait info screen, rotate , touch back, tries go info portrait not main page (that work correctly in both modes).
same true if rotate main landscape first. go info, looks right, i'm on info landscape view. if rotate portrait , hit tries go landscape info view.
update2
see code added update2. makes work way want to.... once. odd. first time works perfectly, want to. when touch info second time, views clipped. portrait view trying displayed in landscape mode , vice versa. sounds need reset subview boundaries?
know it's stupid, not sure yet.
in advance.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment