uiview

Calling setNeedsDisplay on a UIView from another class

I have a UIView subclass that I manipulate a lot of graphics on based on touches. All the [self setNeedsDisplay] calls seem to be fine. However, I used an instance variable pointer to my same UIView subclass instance, and then tried manipulating it and then calling [UIViewSubClass setNeedsDisplay] from another UIView class, and DrawRe...

When I open a custom UIView from a UITableViewController, how do I close the custom view and go back to the table view?

I'm using a UITableViewController for a menu in a game. The table view opens a a view controller for my custom UIView that shows the game. When the game finishes the UIView is notified (which is kinda ruining the MVC principals) and from there I am kinda lost. Questions: Can a UIView communicate with its controller? How? Can one contr...

How would I reference a global variable in my UIView ?

I have a UIView which is accessed by two different View Controllers. Whenever the user presses a button through the view controllers, I increment/decrement a shared variable like: -(void) viewWillAppear:(BOOL)animated { [[self appDelegate] sharedData].count++; } The shared variable gets created and initialized in the app delega...

How does one access a super's view controller?

Hi guys! I have a problem and I will try to explain the issue: I have one main UIViewController (Whole screen) I have one secondary UIViewController (setbounds) I added my secondary view to my mainview using this: [mainController.view addSubview:secondaryController.view]; I created a third controller: modalController, i added it to m...

Removing View from its SuperView, Notifying the Subviews on iPhone

Hello All, What event is fired when a view is removed from its super view? Do its sub-views receive any message? For example, I have subview2 and subview3 added to subview1 as in super_view -> subview1 -> subview2 -> subview3 if I remove subview1 e.g. by [code] [subview1 removeFromSuperview]; [/code] What event its subviews(subview...

How do I use a UISegmentedControl to switch views?

I'm trying to figure out how to use the different states of a UISegmentedControl to switch views, similar to how Apple does it in the App Store when switiching between 'Top Paid' and 'Top Free'. ...

Why doesn't UIButton title display?

In a UIViewController's viewDidLoad method, I do this: UIButton *b = [[UIButton buttonWithType:UIButtonTypeRoundedRect] initWithFrame:CGRectMake(0, 0, 100, 100)]; [b setTitle:@"Testing" forState:UIControlStateNormal]; [b setTitleColor: [UIColor blackColor] forState: UIControlStateNormal]; [self.v...

Resetting the origin of a transformed UIView descends into craziness

I rotate/scale a UIVIew using [UIView transform:] and this works well. However, as soon as I change the view's frame origin the contents of the view begins to scale 'weirdly' even though I am not performing any further CGAffineTransforms. Why does this occur? How can I prevent it? Update 1: The docs suggest that the frame is invalid a...

how to get UIImageView coordinates?

Hello, I have to calculate an angle beetween two UIImageView and i don't find how to get the UIImageViews coordinates(the four corners coordinates). Is there a property for that? thanks ...

Conceptualizing Cocoa Touch Views, Controllers & OO programming in general

This is pretty high level but Cocoa is big and I'm still trying to get my head around it. Can someone validate my expectations... Say I'd like to have a variable number of views (images of cars for example) on the screen that the user can touch and move around. Would you start by subclassing UIView with UIImage property (as opposed to U...

Not sure why UIView is being nudged up by around 10px

Hi, I've created a simple iPhone app which has two .xib files. In the app delegate at application did finish launching I display the first .xib file by calling: [window addSubview:myView]; and I do the same on an IBAction for a UIButton to change the view to myView2. What I'm finding is that there's a white bar of around 10 pixels wh...

Adding multiple UIButtons to an UIView

Hi, I've added some buttons to an UIView (via addSubview) programmatically. However, they appear as overlays (so that I always see the last button only). How do I add new buttons below existing buttons? Regards ...

Clipping within an UIView with some subviews

Hello, I have some buttons in an UIView. My problem is, that they get cut off at the right side of the UIView. How do I prevent this? I've checked already Interface Builders clip property, but it's no solution for this problem. Regards ...

uiview animation used to work on iphone sdk 2.2 and now it doesn't on sdk 3.0

hello! I have an animation block that worked fine when runnung the app on iphone OS 2.2. Now I compile the same code for iphone OS 3.0 and it doesn't work. UIViewAnimationTransition trans = UIViewAnimationTransitionFlipFromLeft; [UIView beginAnimations: nil context: NULL]; UIView *forview = [[self view] superview]; [UIView setAnimati...

How can I get the pinstripe background to show?

I'd like to use the pinstripe background that shows up in the Settings app and many other iPhone apps behind table views. Is is already included in some graphics library? How can I make it show up in a UIView or UITableView? ...

How do I accelerate the touchesBegan event firing?

Hello, I have a UIView where I use the touchesbegan event, but I realized that once I put my finger on it, the touchesBegan event takes like 1 or 2 seconds to fire. How can I make this happen faster? thanks!!! ...

My UIViewController is "lying" about its center property

I'm asking my ViewController for it's view.center property and drawing a new UIView that centers itself around this "center"... I am getting (160, 250) as a response. but when the new UIView draws it's below center... So I'm wondering who's giving me this info and what it relates to? This is clearly where the center of the view is in re...

How do you use Interface Builder to control UINavigationControllers properly?

Hello All, I have been in the process of learning to build iPhone applications for the last two weeks. I've gotten through a fair amount of content, and now I'm trying to create a modal pop up with presentModalView. I can can successfully create and slide up a view, but I notice that modal views don't provide you with a default navigat...

Reconstituting objects from nib - Just add water? maybe not...

Much I've read talks about the advantages of setting your UI up in IB. And how when the nib is "awoken" all the objects in it "come to life". I'm experimenting with placing about 10 UIView objects into a nib that is owned by a ViewController. The UIView objects are of type MyView and are wired back to their respective properties in the...

Pushing and Popping view controllers - animation

Hi, I'm using a navigation controller for my app, because a lot of my views are hierarchical. However, I want to push a settings view when someone presses a button. However, I don't want to animate right to left, since I don't want to give the impression to the user that settings are a child of the view below it in the stack. Is there ...