uiview

Remove UIVIew from SuperView with Animation

I can animate the addition of a UIView to my app, it looks very pretty so thank you apple. However, how do I animate the removal of this view from the super view? I'm using: CATransition *animation = [CATransition animation]; [animation setDuration:1]; [animation setType:kCATransitionReveal]; [animation setTimingFunction:[CAMediaTimi...

iPhone UIView Animation Best Practice

What is considered best practice for animating view transitions on the iPhone? For example, the ViewTransitions sample project from apple uses code like: CATransition *applicationLoadViewIn = [CATransition animation]; [applicationLoadViewIn setDuration:1]; [applicationLoadViewIn setType:kCATransitionReveal]; [applicationLoadViewIn set...

Flipping UIViews From Top / Bottom

I'm well aware that there are only two available UIView transitions, UIViewAnimationTransitionFlipFromLeft and UIViewAnimationTransitionFlipFromRight. I'm wondering if there is anyway that I can implement / emulate a UIViewAnimationTransitionFlipFromTop or UIViewAnimationTransitionFlipFromBottom. The only way I can think to do this is ...

[iPhone] Is current graphic only available in view's drawRect: ?

I tried invoking UIGraphicsGetCurrentContext() in other places other than in drawRect. It give me a NULL. Is it true that I can can only get current context in UIView's drawRect: only? ...

How do I override the "view" property in UIViewController?

I have a custom UIViewController and custom UIView. I'd like to override the viewcontroller.view property to return MyCustomUIView. Right now I have: @interface MyViewController : UIViewController { IBOutlet MyView* view; } @property (nonatomic, retain) IBOutlet MyView* view; This compiles but I get a warning: property 'vi...

Changing a view's visibility affect's parent's clipping

Hi, I've encountered a really, really weird behavior mix that I believe has to be a bug, and I'd like to either be enlightened, or work with you guys to find a workaround. The issue is as follows: UIView* bigView UIView* barView UIView* buttonView UIView* imagesView buttonView and imagesView are children of barView, which in turn i...

Best way to have a view temporarily expand to fill the iPhone screen

I have a library that programmatically constructs a UIView that exhibits my custom behavior. This library could be dropped into many different applications at different places in the view hierarchy. Under certain circumstances the view needs to "expand" to fill the screen real estate. I am currently doing this by having my code walk t...

How can I tell if a UIView is in front (visible)?

I need to detect which view is in front (currently visible). How can I do this? Here is a what I would like to do: if ( ! <<methodToTellIfViewAIsInFront>>) { [viewA prepareToDisplay]; [window bringSubviewToFront: viewA]; } ...

UIViewControllers and UIViews... how to architect a simple app

I'm a bit confused about how many controllers I need, and when I can load in UIViews into the same controller, versus having two controllers for two separate UIViews. Here's my current situation. I have a simple app that takes in information on the beginning screen, and then based on the info from the user (via a UIPicker and a text...

Accessing Views created in Interface Builder

I've created a ChildViewController class, and then a nib that uses that class. Then I created a BaseView, that includes some buttons, and some text that I'll be changing programmatically. Then I created two more views (Boy and Girl), that I want to be able to lay behind the baseview so that the background color is different along w...

architecting a visual grid of 'buttons'

I'm trying to design how to implement a relatively simple application. I want to create a grid of 'squares' that cover an entire screen. Each square should have the ability to respond to touch events, and then have an on/off state. For example, if I touch an 'off' square, and then drag my finger across 10 other squares, I want them ...

Subviews not showing up in UIView class

I'm trying to lay out some images in code using addSubview, and they are not showing up. I created a class (myUIView) that subclasses UIView, and then changed the class of the nib file in IB to be myUIView. Then I put in the following code, but am still getting a blank grey screen. - (id)initWithFrame:(CGRect)frame { if (sel...

subview running but not showing

From withing a UIViewController that is tied to a UIView (drawn in a nib file), i try to add another view, as a subview to the first view. In case you are confused: UIViewController -> UIView + GraphView (extends UIView) So i am saying: GraphView *myGraphView = [[GraphView alloc] init]; graphView = myGraphView; [self.view addSubview:g...

Do I have the right understanding of frames and bounds in UIKit?

Let me try to explain it. Please tell me if I am wrong. I am just 70% sure about it. Like I understand it, an UIView has a frame and an bounds rectangle. The job of the frame rectangle is to set the position of the UIView relative to it's superview. More precisely: Relative to the coordinate system of the superview. The job of the bound...

View Transformations: Is there an better explanation of the one from Apple?

Apple says: Translating a view shifts all subviews along with the drawing of the view's content. Because coordinate systems of subviews inherit and build on these alterations, scaling also affects the drawing of the subviews. Like I understand, when I do a transformation on a view, this will effect all subviews as well. B...

Resizing a UIView to make it scrollable in a UIScrollView

I added a UIScrollView in my appDelegate, and then did scrollView.contentSize = CGSizeMake(720, 480); scrollView.showsHorizontalScrollIndicator = YES; scrollView.showsVerticalScrollIndicator = YES; scrollView.delegate = self; [scrollView addSubview:viewController.view]; [window makeKeyAndVisible]; Where view Controller loads up a UIV...

Rendering UIView with its children (iPhone SDK)

I have a UIView that has an image and some buttons as its subviews. I'd like to get a "snapshot" image of it using - renderInContext, or other method. [clefView.layer renderInContext:mainViewContentContext]; If I pass it my UIView (as above) then I get a blank bitmap. None of the children are rendered into the bitmap. If I pass it t...

Zoom in/out gesture UIView

Hi, i've been trying to capture gesture zoom in/out in a UIView. Code: NSSet *allTouches = [event allTouches]; NSArray *twoTouches = [allTouches allObjects]; UITouch *first = [twoTouches objectAtIndex:0]; UITouch *second = [twoTouches objectAtIndex:1]; CGPoint firstPoint = [first locationInView:self]; CGPoint secondPoint = [second lo...

Is there a reason I can't initialize a CALayer outside a UIView class?

I have been trying to us CALayers as "sprites" in an iPhone application I'm working on. From what I have been reading, that seems like the correct thing to do here. When I setup the layer inside a UIView class I am able to get the layer to show up on the screen: NSLog(@"GameView initWithCoder"); NSString* imagePath = [[NSBundle mai...

Load a UINavigationController as a subview from UIViewController

I am a newbi in iPhone development.I want to build an app which will have a UIViewController first , which will have a button.Now on clicking the button, it shud load a UINavigation controller. Here is how i m approaching : i created a UIViewController class, where i took a -(IBAction) PressMeFunc:(id) sender for the button to b...