Tuesday, 15 May 2012

ios - UIButton changing position doesn't work -



ios - UIButton changing position doesn't work -

i have problem changing position of uibutton, created in interface builder. have outlet in 1 of classes. need alter position of button according user default, saved in standard user defaults. problem is, button's position won't alter after calling code:

self.planbutton.center = cgpointmake(244, 234);

i have tried phone call [self.planbutton setneedsdisplay]

i have tried phone call [self.view reloadinputviews]with no effect.

thanks help

you should utilize setframe

[self.planbutton setframe:cgrectmake(244, 234, self.planbutton.frame.size.width, self.planbutton.frame.size.height)];

edit:

try this

self.view.autoresizessubviews = no;

if doesn't work, might want in

(void)viewdidlayoutsubviews instead of viewdidload or viewdidappear

ios objective-c uibutton position

No comments:

Post a Comment