uiview

How to find out the "True" x ,y values of a view

Hi If I have a view inside another view, than its x,y values are relevant to its parent view. I would like to know its x y position relative to the whole screen window- that means 320 X 480 iphone screen window The top left corner is 0,0 of course. What is the way for getting its "True" x ,y values? Thanks. ...

How do I change the UIView programmatically?

I have created View A and View B. My window has View A displayed on the screen. I also have a UIButton on View A. I want to switch from View A to View B when I click on the Button. I am not using any UIViewController. Is it possible to switch the views without using controller? I am calling buttonAction method on TOUCHUPINSIDE The prob...

How to load a UIView from a NIB?

I have been using UIViewControllers and initWithNibName with much success, basically using them as a convenient way to design the view with Interface Builder. Unfortunately I have built a hierarchy of views before noticing this line in the UIViewController documentation: Note: You should not use view controllers to manage views th...

what UIView layer.masksToBounds is doing if set to YES

Anyone knows? I found few answers but there were too complex and going too deep ... I need some simple answer :) ... thanks, O. ...

Darkening a UIView

I'd like to "darken" a UIView by a certain amount. Right now, I'm doing the darkening like this: UIView *overlay = [[UIView alloc] initWithFrame:mainView.bounds]; overlay.backgroundColor = [UIColor blackColor]; overlay.alpha = 0.5f; [mainView addSubview:overlay]; Unfortunately, this also adds a semi-transparent black overlay to parts ...

Subclass of UIView with Xib file.

Hey guys, Although I've searched the Board and used google, I didn't get any useful results. I've trying to make a subclass of UIView loading its view from a xib file. My approach is the following: 1. Creating a subclass (named mySubclass): @interface mySubclass : UIView { } @end Creating a view through: Add New File... User Inte...

UIView removeFromSuperView animation delay

I have a method which animates one of the subviews of UIWindow and then removes it from UIWindow using removeFromSuperview. But when I put removeFromSuperview after animation block, the animation never shows, because removeFromSuperview removes the UIView from UIWindow before the animation plays :-( How can I delay removeFromSuperview so...

UIButton tapped to swap to another xib

I have a UIButton in my MainWindow.xib When I tap the button, I want to swap the view. How do I do that? I also want to transfer some data between the views (such as color preference and a string) ANy sample code OR links to where I can find my answer would be very helpful. ...

Why does initWithFrame have the wrong frame value?

I have a subclass of UIButton called INMenuCard and I am overriding the initWithFrame to include an activity indicator. The menuCard places correctly but any internal reference to "frame" give me "inf,inf,0,0" which means my activityIndicator subview is not placed correctly. What might I be missing? @implementation INMenuCard - (id)ini...

Strategy to lazy load images for buttons within UIScrollView?

I have a horizontal UIScrollView that contains UIButtons (though it could be any object). I would like to only download images for these buttons as the user scrolls and they are seen. I would also like an activityindicator running on each button while the images are downloading. Here's what I've tried with results: Check content offset...

How to create a controllable flip effect (flip as far (and fast) as you drag) of an UIView

I have a card (a flashcard you could say) What I can do: On fingersweeping over the flashcard the card gets turned. It's happening by detecting touchesBegan and touchesMoved and then I do stuff like [UIView beginAnimations:@"View Flip" context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationCurve:UIViewAnimationCurveEas...

Automatically Sizing UIView after Adding to Window

Note: This may be a duplicate of Subview Doesnt AutoSize When Added to Root View Controller I have an iPad app that switches between different views in its main window. The view-switching code looks like this: - (void)switchToViewController:(UIViewController*)viewController { if (currentViewController != viewController) { ...

Does mixing Quartz and OpenGL-ES cause big performance degrade??

I have a plan to make a game using OpenGL for 3D world view, and CALayer(or UIView) for HUD UI. It's easy to imagine performance degrade from mixing them, but the document which mention this impact disappeared: http://developer.apple.com/iphone/library/technotes/tn2008/tn2230.html I cannot find the document on current version of SDK refe...

Why Does the iPad Main View Refuse to go FullScreen?

I am doing an imaging app for iPad and it requires use of the entire screen. The approach I have used on iPhone does not appear to work on iPad. In Interface Builder I have set the UIToolbar to translucent.This code echos the dimensions of the main view before and after requesting fullscreen. - (BOOL)application:(UIApplication *)applica...

Where are events in Cocoa Touch?

Hi all! I learn Cocoa Touch several days, and today have stuck while looking for way to implement a custom event. Event that I can see in Connection Inspector for my UIView subclass. What I have: There are a UILabel and MyView:UIView on MainVindow. MyView contains a UISlider. Interfaces for Controller and MyView // Controller.h @inter...

What method of UIView gets called when instantiated from a NIB?

I have a simple custom view that is connected via outlet to a NIB. For this particular view, there are actions that I would like to perform on the view when it is initialized, no matter what NIB it is on. Trouble is, neither the (id)init or the (id)initWithFrame:(CGRect)frame methods are getting called on the custom view. Which method ...

UIView "suck" animation

I'd like to use the UIView "sucking" transition (view is "sucked" into a point) referenced here: http://iphonedevwiki.net/index.php/UIViewAnimationState#Using_suckEffect The method above, however, uses private APIs, which makes it next to useless for an App Store app. How can I recreate a similar effect without relying on private APIs?...

How do I make a custom delegate protocol for a UIView subclass?

I'm making some tabs and I want to have my own delegate for them but when I try to send an action to the delegate nothing happens. I also tried following this tutorial: link text But it doesn't work for me :( Here is my code: TiMTabBar.h @protocol TiMTabBarDelegate; @interface TiMTabBar : UIView { id<TiMTabBarDelegate> __de...

How do you create a DropShadow on a UIView

My current code doesnt seem to do anything: CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGContextSaveGState(currentContext); float myColorValues[] = {1.0, 0, 0, .8}; CGColorSpaceRef myColorSpace = CGColorSpaceCreateDeviceRGB(); CGColorRef myColor = CGColorCreate(myColorSpace, myColorValues); CGContextSetShadowWithC...

Building a clip area in a UIView from path objects in its subviews

I'm trying to produce a clipping area in a UIView that's generated from path objects in its subviews. For example, I might have one subview containing a square and another containing a circle. I want to be able to produce a clip in the parent superview that's the union of both these shapes. Can someone explain how to do this? About all I...