Saturday, 15 May 2010

objective c - iOS Cocoa UITableView position after rotate -



objective c - iOS Cocoa UITableView position after rotate -

i can utilize code position uitableview wherever want it:

cgrect newframe = self.atableview.frame; newframe.size.height = 300.0; newframe.size.width = 300.0; newframe.origin.y = 400; newframe.origin.x = 400; self.atableview.frame = newframe;

the above code works fine. when rotate table view using next code, gets positioned @ (0,0) in other words, top left of screen:

cgpoint oldcenter=self.atableview.center; self.atableview.transform=cgaffinetransformmakerotation(-m_pi_2); self.atableview.center=oldcenter;

how can position table 1 time rotate it?

thank much insight may able provide.

the problem beingness caused not detecting iphone's rotation. in other words: • code rotating table fine • simply rotating table did not cause disappear problem was not detecting iphone's rotation. rather detail wrong methods used, share worked xcode 5 / ios 7.

here worked:

- (nsuinteger)supportedinterfaceorientations { homecoming uiinterfaceorientationmaskall; } - (void)willanimaterotationtointerfaceorientation:(uiinterfaceorientation) interfaceorientation duration:(nstimeinterval)duration { //this place code rotate table //i test interfaceorientation see current orientation nslog(@"%d", interfaceorientation); }

by using method of detecting phone rotation, code alter frame of uitableview worked every time.mainly based on:frame doesnt changes while orientation in ipad

ios objective-c xcode cocoa-touch uitableview

No comments:

Post a Comment