objective c - iOS Crash if the orientation changes while view is changing -
i having bug if orientation of device changes while view changing view lose of subviews , if action taken app crash.
i tried turning off listening orientation changes if viewwilldissappear still doesn't solve problem. has else had problem? , how can fix it?
edit: exception getting "can't add self subview"
here how push new view controller
classa.h
@class classb; @interface classa : uiviewcontroller { classb *classb; }
classa.m
-(void)buttonaction:(uibutton*)sender{ classb = [[[classb alloc] initwithnibname:@"mynibname" bundle:nil classa:self] autorelease]; [self.navigationcontroller pushviewcontroller:classb animated:yes]; }
classb.m
//turn on orientation -(void)viewwillappear:(bool)animated{ [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(orientationchanged:) name:uideviceorientationdidchangenotification object:nil]; } //turn off orientation -(void)viewdiddisappear:(bool)animated{ [[nsnotificationcenter defaultcenter]removeobserver:self name:uideviceorientationdidchangenotification object:nil]; }
edit2: believe problem how detect orientation , change view. work on rebuilding code/getting apples standard orientation code working. thank help.
Comments
Post a Comment