ios - change custom label and button to landscape in xcode 5 -
i create custom button , label in portrait mode , landscape mode separately below:
- (bool)shouldautorotate { uiinterfaceorientation orientation = [[uiapplication sharedapplication] statusbarorientation]; if (orientation == uiinterfaceorientationportrait) { [self addbutton1]; [self addlabel1]; } else if(orientation == uiinterfaceorientationlandscaperight) { [self addbutton2]; [self addlabel2]; } homecoming yes; }
if run code,in landscape mode both buttons , labels displayed. if seek this:
else if(orientation == uiinterfaceorientationlandscaperight) { [self addbutton2]; [self addlabel2]; [custombtn1 sethidden:yes]; }
error:use of undeclared identifier. can help me?
you need implement method:
- (void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation
this method called regardless of whether code performs one-step or two-step rotations.
parameters
frominterfaceorientation old orientation of user interface. possible values, see uiinterfaceorientation.
additionally, hide unnecessary buttons.
addbutton2.hidden = yes;
ios objective-c xcode uiinterfaceorientation
No comments:
Post a Comment