CGPointMake doesn't work in viewDidLoad - iphone

I have a button that I need to move on viewDidLoad but it doesn't want to move...
strange thing is that if I use the same exact code on a -(IBAction) then it moves as it should... any clue why is this happening?
the code I'm using to move the button is this:
self.myButton.center = CGPointMake(50, 120);
thanks for any help.
Peace,
Massy

For anyone that run in the same problem I found the solution in this tread: presentViewController: crash on iOS <6 (AutoLayout)
removing the "Use Autolayout" option let my app work fine.

Related

Using EGOPhotoViewController with iPhone 5

Using this on iPhone 5:
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithImageURLs:imageURLs];
[self.navigationController pushViewController:photoController animated:YES];
When I get back to the caller I can see the bottom bar... How should I solve this?
That doesn't happen on 3.5 inch screen.
UPDATE:
Same problem happens on EGOPhotoViewer_Demo
This is how the screen looks on the first usage:
When getting into "Photos" and go back to that main screen it change to:
You can see something hides the bottom of the screen. On my app I have buttons there so it's problematic.
Hope this update makes my problem more clear.
I’m not sure but this might be a duplicate of iPhone 5 app displaying correctly but not sensing touches in “extra” space
Also, do you have the same problem on iOS 6? From the screenshots, it seems you are using iOS 7, which could be the source of your problem.
When compiling with Xcode 5 the problem is solved (test device was iOS 7).
I had the same issue.
The problem is the following statement in viewWillAppear:
[self.navigationController setToolbarHidden:NO animated:YES];
Move this statement and the accompanying "if" test to viewDidAppear and the problem goes away.
To be honest I am not sure why this ever worked - but it makes sense that showing the toolbar when our photo view is not yet up would show the toolbar in the parent view, not the photo view. Moving it to viewDidAppear does the right thing.

Problems with sendSubviewToBack and insertSubview:belowSubview: don't work as they should

I have a problem with sendSubviewToBack and insertSubview:belowSubview: methods. Simply, I have a button which I'm inserting below another view _centerView. I want the button to stay below the _centerView.
The problem I'm facing is that when I insert a button below the _centerView I see a flicker (just for a short moment) over the _centerView. I tried both sendSubviewToBack: and insertSubview:belowSubview: - same effect.
Do you have any ideas what things may be wrong? Am I missing something? Here is my code:
UIButton* itemButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[itemButton setFrame:CGRectMake(0, 0, 40, 40)];
[itemButton setCenter:_centerView.center];
[parentView bringSubviewToFront:_centerView];
[parentView insertSubview:itemButton belowSubview:_centerView];
I recently came across this same issue, but passing this option to the animation code fixed it. Hopefully this is helpful to you too. I wouldn't have come up with my solution without your comment though, so thanks for that :)
UIViewAnimationOptionShowHideTransitionViews
I'm not sure what the internal structure behind insertSubview is, but if you want to get rid of the flicker, the easiest way would be to hide the view before inserting it and show it again afterwards.
[itemButton setHidden:YES];
[parentView insertSubview:itemButton belowSubview:_centerView];
[itemButton setHidden:NO];
Not the most elegant solution, but it should get the job done.
OK, so after a while it turned out that this is the fault of the window I animated the same time I added the button. I don't know why but the fade in animation of the window was causing this problem. I switched of the animations of my UIWindow and now it works. Thanks for help!

TTLauncher View of Three20 not working

I have followed a tutorial to make a simple launcher view like in facebook app. But nothing is displayed on screen when program runs and it shows only a white screen. I dont know why this is happening plz help.
The tutorial i followed is at [I have followed a tutorial to make a simple launcher view like in facebook app. But nothing is displayed on screen when program runs and it shows only a white screen. I dont know why this is happening plz help.
The tutorial i followed is at http://iosguy.com/2010/10/19/tthree20-a-brief-ttlauncherview-tutorial .]1 .
I encountered the same problem. The solution that worked for me was to set the background of my "MainWindow.xib" to "Clear Color" (default is "White Color").
If you have no xib, you can still set the color in your AppDelegate: [self.window setBackgroundColor:[UIColor clearColor]];
if u need only launcher effect , better try this , light weight library
https://github.com/rigoneri/myLauncher
Hope this Helps!
It seems to me that the method:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
is lacking at the end:
[navigator.window makeKeyAndVisible];
If you need more help, please, post your code...

How to change image of a button?

im getting a EXC_BAD_ACCESS error on this line.
[(CCMenuItemSprite*)[profileSelectionMenu getChildByTag:333] setNormalImage:normalSprite3];
Basically im just trying to change the normal image of a CCMenuItemSprite.
normalSprite3 and selectedSprte3 are both CCSprite. and i set the properties off them to retain but it still always crashing on the above line. Is there an easier way to do what im trying to accomplish? basically set the button to be a toggle button? and it changes image everytime it is pressed
normalSprite3 =[CCSprite spriteWithFile:#"main_menu_button.png"];
selectedSprite3 =[CCSprite spriteWithFile:#"main_menu_button_select.png"];
profile3MenuItem = [CCMenuItemImage itemFromNormalSprite:normalSprite3 selectedSprite:selectedSprite3
target:self
selector:#selector(P3:)];
[profile3MenuItem setTag:333];
[(CCMenuItemSprite*)[profileSelectionMenu getChildByTag:333] setNormalImage:normalSprite3];
Thanks for any help
G
Why not just
[profile3MenuItem setNormalImage:normalSprite3];
Also, where do you add the item to profileSelectionMenu so that getChildByTag works?
UPDATE: I wrote this to help with debugging EXC_BAD_ACCESS
http://loufranco.com/blog/files/Understanding-EXC_BAD_ACCESS.html
If you think you are releasing early, turn on NSZombiesEnabled
http://loufranco.com/blog/files/debugging-memory-iphone.html

UIActionSheet is taking longer to load

are their any reasons why my UIActionSheet would be taking a while to load. It works fine just after lauch, but as soon as I loop through some actions once or twice, is loads very slow, and you can see the grey backdrop crawl down to finish drawing the sheet.
help?
Sam
Ok, so I found the solution moments later.
I assume this is how it works, feel free to correct me.
U used the cheats animation way of [ UIView ]
and i guess this changed the way for the UIActionSheet to pop up, so I wrote in these two lines before i asked it to show.in.view
- (IBAction)goToBlog{
contactUs.actionSheetStyle = UIActionSheetStyleDefault;
[UIActionSheet setAnimationDelay:0];
[UIActionSheet setAnimationDuration:0.1];
[contactUs showInView:self.view];
}
and that seemed to work. so im happy.