uiview

drawing in an uiimage, then scaling, then drawing more problem

I'm trying to create a view that a user can draw in, use multitouch to scale, and then draw some more. I have a basic view (canvas) where I add an imageView (sized to the canvase) and nil image. I draw in (on?) the image by using drawInRect. I copied my drawing code from here. This works fine. I then added a multitouch check in touch...

What is the best way to load a custom UIView?

In my iPhone app, I made a custom UIView that I use in several different view controllers to display some information. I'm familiar with making customer table cells for use in a table but I've never made a custom view again. My question is what is the best way to load this view? I've tried simply placing the view in the view controlle...

UIView in UIView issue

Perhaps I'm missing a property or misunderstanding something but having issues with something simple. I have a UIView with a frame lets say of 100px high in which I have another UIView with lets say 50px high. If set the main UIView to 20px high the 50px high one is fully visible. I thought it might of been something to do with the boun...

Gotta Catch'm All! - UIView over UITableView not receiving taps

Hey guys, The problem with this app is that the TapCatchingController does not receive the taps that are on section headers or between sections. I'd like to learn how I should do that. I have tried to keep my sample program as small as possible, but it's still rather long, sorry for that. The code is however self contained. If you copy ...

iPhone OS 3.2 equivalent of [CALayer contentsScale]?

Hey I'm trying to do the equivalent thing that the iOS 4.0 method CALayer::contentsScale does, which scales the size of the backing bitmap of the layer. Any way to do this in iOS 3.2, probably by setting the frame size and applying a transform? ...

Difference between [UIView beginAnimations:context:] and [UIView animateWithDuration:animations:]

It appears to me these two class methods are not interchangeable. I have a subview of UIView with the following code in the touchesBegan method: if (!highlightView) { UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Highlight"]]; self.highlightView = tempImageView; [tempImageView release]...

Forcing a view to unload when another tabButton is hit. (iPhone)

My iPhone app has a tabBar at the bottom. The 5th tab is rarely used... but pretty memory-intensive... so I want to make it UNLOAD each time it is exited (by the user clicking on a different tab). But how? I thought I just needed to call "[self viewDidUnload]" but that doesn't seem to do it. Where is the "forceThisViewToUnloa...

Delay between play button and movie showing

Hi there, I have a simple view that creates a MPMoviePlayerViewController when the user presses a button, using the presentMoviePlayerViewControllerAnimated: method. The new view controller slides in and shows the movie player, so far so good. However, when the button is pushed, the current view controller slides out the bottom, showin...

ObjC - UIViews: animating view and subview independently?

Hi! I have an UIView and its subview. When I animate myView (size.x+20) my subview is being animated too, however I want to translate my subview at the same time independently(origin.x-40) (without the subview moving because of the resizing of myView). I was able to do it by adjusting the translations (or better position, because I mig...

Animate multiple UIButtons

Hi I am beginner to iOS and I have a question. I want to re arrange multiple buttons when changing orientations so i have this code to create them : NSArray *buttonImages = [[NSArray alloc] initWithObjects:@"button_1.png",@"button_2.png", @"button_3.png", @"button_4.png", nil]; int xcord = 0; //int ycord = 0; UIInterfaceOri...

Subclass UIView or UIViewController

I want to make a "section" which has an image and some text below it. Should I be subclassing UIView or UIViewController? I'm thinking UIView as it won't know what image or what text to display, just that there will be both. Also if it is UIView, what method do I add the subviews (UIImageView and UILabel) in as subviews? Or should I dra...

Why do UIViewControllers have xib files and UIViews do not?

When I create a new UIViewController in xcode, it offers to make me an associated nib for the interface. However, when I create a UIView, it does not. If my understanding of MVC is correct, views should really be the parts that contain the interface elements (i.e. the nib) while view controllers are the parts that hook the functionality ...

Best Design Practices if there are more than one views in an Application

Hey champs, This question is for iPad apps designing. I searched a lot on this very useful site but i didn't find anything related to the question. Suppose my application needs to present multiple views to the user, then what is the best way to do that. The ways i think that are possible are 1) Use only one view controller and add all...

touchesBegan Event Stops Firing After a Lot of Scrolling

I have a series of UITableViews displayed in a horizontal ScrollView. Inside each tableview, each TableViewCell consists of 2 thumbnail tiles which represent a detail view. I am using touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event to catch when one of the tiles has been tapped. From there, I am pushing a detail view onto the Na...

Cocoa Touch: are dynamically XML-defined views possible?

Hi all, first post. Been an iPhone developer intern for about five weeks now. I've read a lot of introductory Apress material, but please take it easy if I make some vocabulary violations. So far I've been able to find answers by searching and lurking. However I now have a task for which I can find little relevant information. My iPhone...

iPhone -- Adding behavior to multiple UIView subclasses

I have a data-driven method which creates and returns instances of various UIView subclasses. Depending on the input data, it currently returns UIButtons, UITextFields, UILabels, and my own subclass, with more subclasses likely to be added later. I want to be able to add behavior to whatever I am returning. At present, this behavior c...

Hierarchy of iOS App UI

I am getting confused reading about CALayers, UIViews and View Controllers. Can someone explain the relationship each of those have to each other (and include anything I might have missed?). I am particularly interested in a View that may have more than one layer. Does that mean the the View Controller has multiple UIViews or that the U...

Releasing object due to retain count

Hi all, I have an issue with releasing a view too many times. Although simple in theory because im moving uiview to uiview, which is a subclass of uiview and being animated and so on its not something that I can easily fix. It only crashes 10% and only under certain conditions and only 30% of the time even under these conditions. So i...

UIGestureRecognizer in UITableView - Crash After Scrolling?

I have a UITableView with custom cells. Inside each cell is 2 views. Each view has a UIGestureRecognizer attached to handle tap events. When the view is tapped, I send a message to a UINavigationController to push a detail view. This scenario works fine until I actually scroll the table. After the table is scrolled, the app crashes when ...

Splitting one main UIView into Multiple UIViews for Sprite Drawing (Quartz 2d)

Hi all, I currently have a game which uses one single UIView to draw a number of sprites onto the screen in its drawrect method every game tic. I have been advised that for performance it would be better to separate out each sprite into it's own UIView. My questions are : Structurally how does this work ? Do I create one UIView and t...