objective c - Handle all rotations for dynamic view in iOS -


i've created runtime image view , added subviews (just like splash screen concept). i've handle 4 rotations ipad approach it?

my code snippet:

    uiview *mainscreen = [[[uiapplication sharedapplication]delegate]window];             uiview *windowblocker = [[uiview alloc]initwithframe:mainscreen.frame];     windowblocker.tag = 999;     imageview = [[uiimageview alloc] initwithframe:cgrectmake(165, 200, 450, 480)];             imageview.layer.backgroundcolor=[[uicolor colorwithred:248/255 green:248/255 blue:248/255 alpha:0.5] cgcolor];     imageview.alpha = 0.6;      imageview.layer.cornerradius=10;     imageview.layer.maskstobounds = yes;     [windowblocker addsubview:imageview]; 

this below approach painful set each subview's co-ordinate each rotation. isn't it? how handle rotation here. have disable auto layout scrolling purpose.

-(void) willrotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration {     if (tointerfaceorientation == uiinterfaceorientationlandscapeleft) {         nslog(@"landscape left");         self.lblinfo.text = @"landscape left";     } else if (tointerfaceorientation == uiinterfaceorientationlandscaperight) {         nslog(@"landscape right");         self.lblinfo.text = @"landscape right";     } else if (tointerfaceorientation == uiinterfaceorientationportrait) {         nslog(@"portrait");         self.lblinfo.text = @"portrait";     } else if (tointerfaceorientation == uiinterfaceorientationportraitupsidedown) {         nslog(@"upside down");         self.lblinfo.text = @"upside down";     } } 

pls guide. thanks

uiview *mainscreen = [[[uiapplication sharedapplication]delegate]window]; uiview *windowblocker = [[uiview alloc]initwithframe:mainscreen.frame]; windowblocker.tag = 999; imageview = [[uiimageview alloc] initwithframe:cgrectmake(165, 200, 450, 480)]; imageview.layer.backgroundcolor=[[uicolor colorwithred:248/255 green:248/255 blue:248/255 alpha:0.5] cgcolor]; imageview.alpha = 0.6;  imageview.layer.cornerradius=10; imageview.layer.maskstobounds = yes; [windowblocker addsubview:imageview];      [[[mainscreen subviews] objectatindex:0] addsubview:windowblocker]; 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -