I'm using setNeedsDisplayInRect: as much as possible in my UIView subclass, but I don't know what to do in drawRect:. What is the best way to detect which parts of the UIView have to be drawn? Right now I've divided my UIView into several CGRect's. For each CGRect I'm calling CGRectContainsRect() to check whether that CGRect needs to be ...
I know UIView's hitTest:withEvent: method digs down to the far-most view that gets the touch event, but how would you get the opposite result? The first view to get an event at a certain CGPoint?
EDIT
As zem pointed out, that hitTest method returns the farthest descendent in the view hierarchy. In my case, I have a mapView with a bunch ...
In the following UIView animation block, I do a CGAffineTransformMakeScale and a CGAffineTransformMakeRotation, and though the duration is set to 1.0f, the scale goes really fast and the rotation goes in 1 second like it should.
It must be my lack of understanding about how AffineTransforms are applied but I can't figure it out.
What g...
Here's a follow up to a previous question. My code below animates a square by scaling it and rotating it. It does this by making a rotation transform and adding a scale transform to it. That works fine. When it's done, it calls throbReset. I used to have throbReset just set self's transform to a CGAffineTransformMakeScale and that w...
On the iPhone, we can simply use (void) viewDidAppear:(BOOL)animated; to perform actions when a view becomes the focus. In some events, we have a modal view with another modal view on top of it and, on the iPhone, closing the topmost modal view will fire the viewDidAppear for the lower modal view.
This is not the case for the iPad, as t...
I would like to add a Welcome view to my app which describes the instructions etc.
I would like this to appear only once when the app is first launched... then with subsequent launches go to my app's main view... which is a navigation controller.
What is the best way to track launches/ implement this idea?
Thanks.
...
Hello,
I was wondering what would be the best configuration of view controllers and views for an app that I’ve been planning out. Conceptually, the way I would like to lay out the app is with an initial loader/browser view, likely with document thumbnails. When a user chooses to open one, a new view comes up that forms the main document...
I want to display a message to the users of my app in the UIStatusBar, but I'd like to maintain the scrollsToTop functionality so a user can tap on the statusbar and scroll a tableView up to the top.
I've looked into adding a UIWindow on top of the current status bar as in this question: http://stackoverflow.com/questions/2666792/add-u...
Hey everyone. I've searched the web and really haven't found a problem quite like this. My set up is as follows: I am trying to make an app where a user drags uiimageviewss on a uiview inside a uiscrollview (which can zoom in), but also drag the image to a trashcan to be deleted. When the scrollview is zoomed in, the user can still drag ...
Hi there
I realise you can make dimentions fluid by using the autoresizing mask to give a flexible width/height.
What about making a position fluid?
For instance if I set the centre of a UIButton at self.view.frame.size.width/2 how can I make it reposition if the view changes size?
Thanks
Tom
...
Here is a image that shows how Good Reader does it just like in the Web View.
http://d.pr/mco6
My guess is that there is no easy approach for this except add tons of code to touchesBegan, touchesMoved and touchesEnd in the custom view and map location of the string to the offset in the view. (Plus the magnifying glass)
Does anyone hav...
The signature of this method is:
- (CGSize)sizeThatFits:(CGSize)size
I don't understand what the size parameter is used for. Apple's documentation states that it is "The current size of the receiver."
But the receiver presumably knows its current size. So why does it need to be passed in?
When I experimentally pass in other va...
When a UIStatusBar is hidden in an app, the origin of all views is (0, 0), the upper left hand corner of the screen. However, when a statusBar is shown, the origin is still (0, 0) yet the views will move down as not to cover the statusBar.
How is this working? Is it possible to duplicate this effect in code?
Essentially, my end goal i...
A UIView has a SizeToFit method that will make the UIView fit all of it's subviews. Is there anything like that, which will just return the size that it calculates and not modify any view's frame.
I have several subviews on a UIScrollView and I want to do SizeToFit on the scroll view's contentSize, rather than it's frame. I have to do i...
Hello guys,
I have two UIViewControllers A and B and they are added as subviews in the AppDelegate with B on top of A.
When a UIButton on B is tapped B slides off to the left with the following code:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[...
I need to set some background image for my view. How can I do this?
...
I have a UIView to which i add a background image. Then to that view i add a scroll view. To the scroll view i add some UIButtons.
I would like to be able to set the scroll view to be transparent (still being able to see the UIButtons) so that i can see the background image underneath it, so that it shows between the buttons.
I have t...
I'm developing a iphone app based UITabBarController,when open the app,on the first tab item,
I press a button,to add a label to the view,and I close the app.
Next open,the label which added last time still on the first tab item,I did not save the view
in applicationWillTerminate method,why?
And,if I switch to the second tab item,and r...
I'm currently having some conflicts with UIGestureRecognizers that is causing everything to place nice with each other. I have several squares (UIView) on the screen that let the user to pan and pinch (used to scale the views). I have a UIPinchGestureRecognizer added to the main view which the squares are added so that I can scale the ...
Good Morning to all,
i have a little question, in this following Code the
self.viewDelegate is 0x0 and i don't know how to solve
this problem. Should i have to go to the interface Builder??
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
if ([touch tapCount] =...