I'm using a partial curl modal in my iOS application. Please see this video:
http://vimeo.com/38643030
During the partial curl transition, the text in the round rect buttons is moving too. How can I stop this?
Put [self.view layoutIfNeeded] in the -viewDidLoad implementation for the view controller that's being shown via the curl animation. This makes the buttons & their contents lay out once before the animation starts instead of trying to do its layout (and redo it as things change around it) during the animation.
Just to add to rickster's answer, I had a similar problem with a UITableViewController and it was necessary to add
[self.view layoutIfNeeded];
[self.tableView layoutIfNeeded];
in the -viewDidLoad. Neither of the above statements worked on their own.
Related
Is there a way to show a UIImageView in front of a UIView (for Preview live)?
I try to make a camera based application so when clicking on a button the app take a pic and show it into UIImageView.
[myView addSubview: myImageView]
should work fine. if not please post your code.
If you are adding the view programmatically the previous suggestion should do it. If the views are in a storyboard or XIB and you want to move it to the front, try this:
[self.view bringSubViewToFront:myImageView];
You might want to use UIKit Peek and Pop if you are on iOS 9 or above.
Also there is this tutorial: http://useyourloaf.com/blog/3d-touch-peek-and-pop/
On iOS 7, when you present a UIPopoverController, the system adds a UIView with some alpha effect to focus the user on the UIPopoverController. So far, so good.
The problem is that if you have a UIPopoverController that's being displayed from the bottom of your screen, and that UIPopoverController content has a UITextField (or anything else that brings the keyboard), the dimmed UIView animation doesn't follow the keyboard very well.
I've created a sample project to isolate the problem. Download Project
And a video of the same issue running on the simulator: Watch Movie
One solution could be to just disable the dimmed UIView as mentioned here, but I would like to keep it if possible.
Is there a workaround or maybe I'm doing something wrong?
I'm starting to consider to fill a bug for this.
Thanks.
Have you tried wrapping your code in a block to disable CoreAnimations implicit animation blocks? Something like this
[CATransaction begin];
[CATransaction setDisableActions: YES];
// Show your popover:
// [myPopover presentPopover:...]
[CATransaction commit];
I'm just starting with iOS development and I was trying to achieve something that doesn't seem to work so far for me...
Here's the situation:
I have a nib file in which I have placed a UITableView, and just underneath a UIToolbar. That works just fine, the scaling is fine if I try different screensizes etc... So I was happy.
But here's the problem:
If the toolbar should be visible or not is a choice that a user can make somewhere in the application. However when the users selects to not see the toolbar I just call the method setHidden on the toolbar and pass it 'YES'.
The toolbar is now gone when I try this but the UITableView is not strechted to the bottom of the screen which gives me quite an ugly result.
So here's finally the question:
How can I automatically let the view stretch to the bottom when hiding toolbar? I guess I will have to do it in code (and not just some configuration option somewhere) but as I'm coming from Android this is somewhat strange for me.
Your best option will probably be to resize the tableview frame as you show/hide the tool bar.
CGRect frame = myTableView.frame;
frame.size.height += toolbar.frame.height;
myTableView.frame = frame;
Because you're using Auto-Layout, you'd want to create a height constraint for the UITableView and link it with your view controller via an IBOutlet. Then, to modify the height of the UITableView, simply do:
_tableViewHeightConstraint.constant += toolbar.frame.height;
You can even animate this with:
[UIView animateWithDuration:0.25 animations:^{
_tableViewHeightConstraint.constant += toolbar.frame.height;
}];
Note that you might need to call [_tableView layoutIfNeeded] after changing the height constraint.
I'm struggling with this problem, and although there are quite some threads on this issue I've not figured it out yet.
I want to load a button into a subview of a scrollview. If I test this subview alone, the button works fine. Also, when I add the button to the scrollview directly, it works fine. But the two combined I don't get any touch event on the button.
My view hierarchy:
UIScrollView
UIView
UIButton (A)
UIButton (B)
So button B works fine, A doesn't.
I've tried messing around with the attributes like Cancellable Content Touches, but so far no luck. I'm loading the subview from the storyboard with:
ViewVC *viewVC = [self.storyboard instantiateViewControllerWithIdentifier:#"ViewVC"];
From the posts I've read, this should just work, so either I'm missing something vital, or I've messed up some attributes along the way. Should I use a delegate to pass the events, or should this be done automatically?
Give your views some colours, and check if one of them is obscuring the other preventing it from being touched. Maybe you UIView is overlapping your UIButton(B), preventing it from being touched.
How are you sure you're adding it?
Make sure you're calling addSubview: on your UIScrollView with your subview as the parameter?
I'm new to Objective-C programming and I'm having a little trouble understanding how I transition between two views.
Basically, I have my main view (the view that loads up when the application opens) and I want to transition to a new view on pressing a button. The user will not need to go back to the main view after pressing the button -- it's basically a title screen.
Could someone please briefly explain the steps I would need to take to make this happen?
Thanks a lot.
You could make use of UIView's class method transitionFromView:toView:duration:options:completion:.
A call to switch from viewA to viewB could look like this:
[UIView transitionFromView:viewA
toView:viewB
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:^(BOOL finished){
[viewA release];
}];
As you mentioned the user won't get back to the mainView I added something to the completion parameter to get rid of viewA afterwards.
You can find the animation options in the constants of the UIView class documentation.
If it's going to be a modal view, you can push on a new modal view controller which will then later be popped off when work is complete. These are usually intended for small amounts of work
[container presentModalViewController:yourNavigationViewController animated:YES];
Otherwise you can modify the UIView stack using the two UIView transition class methods:
+ transitionWithView:duration:options:animations:completion:
+ transitionFromView:toView:duration:options:completion:
For more info on these check out Apple's UIView class docs.
If you don't just want to copy & paste the code you should follow Apple's sample code step by step and remember you can download it:
ViewTransitions sample application
The ViewTransitions sample application demonstrates how to perform transitions between two views using built-in Core Animation transitions. By looking at the code, you'll see how to use a CATransition object to set up and control transitions.