uiview

What is the Proper Way to Dynamically Create Content For a UIView?

I have a tableView with a list of items. When a selection is made, a new view controller is pushed on the tableView's navigationController viewController stack. My question is this: one of the views in the view hierarchy associated with the pushed view controller requires the fetching of data from the network before it can render it's c...

iPhone "flipping" to UIScrollView isn't initially scrolling.

Hi there, I've got this slightly strange issue that I can't quite seem to figure out. I'm following the example given by Apple to "flip" a view. Now the "flipping" is working fine. I'm using an nib file containing two "views" showing "summary" and "detailed" information. The "summary" page is a UIView. Whereas the "detailed" page is...

Finding touch point in Objective c/cocoa touch

I have a problem to find the touch point. I have a function loadView() where I set 16 tiles(16 UIImage View). Then In function: - (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { // Retrieve the touch point UITouch *touch=[[event allTouches]anyObject]; CGPoint point= [touch locationInView:touch.view]; ...

Add a Button in UIView on Tapped Point

Hi im trying to add a button on the point where users tapped on the screen. Here is the code in my UIView file - (void)drawRect:(CGRect)rect { // Drawing code NSLog(@"drawRect, %i, %i", firstTouch.x, firstTouch.y); [tagButton drawRect:CGRectMake(firstTouch.x, firstTouch.y, 100, 200)]; [self addSubview:tagButton]; } - (...

What is the most robust way to force a UIView to redraw?

I have a UITableView with a list of items. Selecting an item pushes a viewController that then proceeds to do the following. from method viewDidLoad I fire off a URLRequest for data that is required by on of my subviews - a UIView subclass with drawRect overridden. When the data arrives from the cloud I start building my view hierarchy. ...

UIView. How do I place a subview behind it's parent superview

I'm doing a bit of UIView wrangling and am stuck. It is straightforward changing the "z" order of sibling subviews. [mySuperview sendSubviewToBack:mySubview] places mySubview behind all it's siblings. But how do I place a subview behind it's parent? Thanks, Doug ...

Can i define UIView as a variable in Objective-C?

According to documents i read, they always show that I should define a subview in a class. Like this : @interface PolygonView : UIView. I have to inherit from UIView. Could i define a variable with UIView type in a class which inherit from NSObject? After that, i make a connection from that variable to UIView which is defined in Inter...

How do i subclass a UIView?

This may seem like a stupid question, but i can't quite remember how to subclass a UIView. Can anyone point me in the right direction? ...

iPhone keyboard-button style for any UIView / UIButton?

Hi guys, I have a custom keyboard in my app and I'd like to have it look similar to the original iPhone keyboard (especially the buttons), just like it has been realized in Twitterrific, for example. Can you point me to a resource where I could find such code, either as a custom drawRect method or as a TTStyle pipeline? Cheers MrMage ...

Should I compose a complex UIView with more UIView's or more CALayer's ?

I have a complex view which is composed of a base image overlaid with other images and 2D paths. I wonder what difference will it make if a assemble the complex view by creating a different UIView for each element and adding them as children of the complex view or if I should instead create a a different CALayer for each element and ad...

How to resize other subviews and parent view when one subview size changes

I have a view which is similar to mail app. I have a scroll view and in that many other subviews. When the user clicks on any textview, it expands to show the text in it. e.g. "to" field in mail. I would want to resize the other subviews such that it starts below the expanded region. How can I do that. I created the view through IB and...

UIView continues to exist after removeFromSuperview

I add a firstView in the AppDelegate : #import "TestViewAppDelegate.h" #import "MainViewController.h" @implementation TestViewAppDelegate @synthesize window; @synthesize mainViewController; - (void)applicationDidFinishLaunching:(UIApplication *)application { MainViewController *aController = [[MainViewController alloc] initWit...

UIView iPhone SDK nested animations

Hello, I would like to have a nested animation for my view. I have one animation stop selector which gets called just fine: [UIView setAnimationDidStopSelector:@selector(growAnimationDidStop1:finished:context:)]; However INSIDE of this selector I want to do more animation and when done yet another selector to be called: (void)growAni...

willRotateToInterfaceOrientation not being called

Hi, I'm returning YES in my view controller's shouldAutorotateToInterfaceOrientation function, and I can see using breakpoints that YES is being returned, however the willRotateToInterfaceOrientation method isn't being called, and nor is any other rotating method. It seems like after returning YES nothing happens! Any ideas? Mike ...

UIView. What is the correct way to remove a subview from a view hierarchy and nuke it

I have a parent UIView with a number of subviews. Periodically I need to remove a subview and completely remove it from the system. What is the correct way to do this? I tried this: UIView *v = [self.containerView viewWithTag:[n integerValue]]; [v removeFromSuperview]; And got bizarre result. Previously present UIViews dissap...

UIView. How do I redisplay a "data driven" UIView?

I am doing a scientific visualization app for iPhone. Periodically a UIView subclass will receive some data from the network that it must render via its overridden drawRect: method. My challenge is that there is no way to indicate to Cocoa-Touch that this data has arrived - or changed - other then [myView setNeedsDisplay] which is ignor...

UIView Hell. Hiding one subview hides them all.

I am apparently in some swirling UIView hell zone at the moment where up is down sibling is parent and my brain is completely fried. Here's the deal. Really, really simple. I have a container view with N leaf node sibling subviews. No tricks here, dead simple. I do the following: // occludedPageSet is the set of view tags correspondin...

Difference between addSubview and insertSubview in UIView class

Hello All: What is the difference between addSubview and insertSubView methods when a view is added programmatically? Thanks Ashwani ...

IB and UIView. What is the correct way to load a view hierarchy from a nib?

Can someone please school me on the proper way to load a view hierarchy from a nib file. I am using the loaded view as a template to stamp out a family of views and the current approach I am using is subtly broken. I don't appear to be copy-ing or retain-ing when I should be. Here's the relevant code: // pageSet is a list of view tag nu...

Interface Builder: How to open a subview in its own window?

When designing/laying out a view in Interface Builder, sometimes it would be nice to be able to open that view in its own window, rather than along with all of its parents. Is there a way to do that? A good example is when you have a long view with controls and labels and text fields, lets call this mycontent view, and this mycontent v...