iphone - UIButton - Frame and Bounds Zero - Page Based Application -
there similar unresolved question bound , frame uibutton
i using storyboards autolayout , "page based application template"
i able reproduce problem making standard page based application adding button storyboard , referencing in
viewdidappear of dataviewcontroller.m
- (void)viewdidappear:(bool)animated { nslog(@"view did appear"); nslog(@"self.mybutton.bounds = %@",nsstringfromcgrect(self.mybutton.bounds)); nslog(@"self.mybutton.frame = %@",nsstringfromcgrect(self.mybutton.frame)); nslog(@"self.mybutton = %@",self.mybutton); }
output
2013-05-14 19:37:45.954 frametest4[10777:c07] view did appear 2013-05-14 19:37:45.966 frametest4[10777:c07] self.mybutton.bounds = {{0, 0}, {0, 0}} 2013-05-14 19:37:45.968 frametest4[10777:c07] self.mybutton.frame = {{0, 0}, {0, 0}} 2013-05-14 19:37:45.970 frametest4[10777:c07] self.mybutton = >
the header file
#import <uikit/uikit.h> @interface dataviewcontroller : uiviewcontroller @property (strong, nonatomic) iboutlet uilabel *datalabel; @property (strong, nonatomic) id dataobject; @property (weak, nonatomic) iboutlet uibutton *mybutton;
when run same code single view application autolayout , storyboards works fine.
the reason need information need run animation ends @ button. ryan
i kind of thing in new ios 5 method viewdidlayoutsubviews
.
be careful though, method potentially called more once, yo might have keep flag around track this.
Comments
Post a Comment