uiview - adapting screen to portrait bug objective-c -
alright having little bit of problem view when device went landscape decided change location of textfields code this:
-(void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation { uiinterfaceorientation orientation = [[uiapplication sharedapplication]statusbarorientation]; nslog(@"spin"); if (orientation == uideviceorientationportrait || orientation == uideviceorientationportraitupsidedown) { cgrect frame = [self.a frame]; frame.origin.x = 20; frame.origin.y = 57; [self.a setframe:frame]; cgrect frame2 = [self.b frame]; frame2.origin.x = 20; frame2.origin.y = 132; [self.b setframe:frame2]; cgrect frame3 = [self.c frame]; frame3.origin.x = 20; frame3.origin.y = 207; [self.c setframe:frame3]; } else { cgrect frame = [self.a frame]; frame.origin.x = 83; frame.origin.y = 21; [self.a setframe:frame]; cgrect frame2 = [self.b frame]; frame2.origin.x = 204; frame2.origin.y = 21; [self.b setframe:frame2]; cgrect frame3 = [self.c frame]; frame3.origin.x = 330; frame3.origin.y = 21; [self.c setframe:frame3]; } }
it worked fine, went suppost to, problem when click on of textfields write of them bug out , end looking this:
uh.. nevermind apparently need @ least 10 reputation before can post image, here's description of image showed instead:
image shows 3 uisegmented controls , 3 textfields crammed stacked on top of each other on top of screen
so i'm more of hobbyist pro @ apologize if stupid question, doing wrong here? , additionaly there better way of going adapting view?
try using auto layout or may auto resizing masks on different views using. there property called autoresizingmask in uiview.
you can check reference: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html
Comments
Post a Comment