cocoa-touch

Add a subview to a window, along with a specific key to toggle visibility?

I've figured out how to create a new UI element where I touch and add it using [self.view addSubview:[uilabel reference]]. However, if I tap in the same place, it'll simply add another subview on top of the current one. I am able to create a unique key for each part of the grid I'm making (and thus placing subviews). Is there any way I ...

Resizing of subviews

Hi, I have a UIView, which contains a UIImageView subview. The subview fills the parent view frame. I am zooming the parent UIView from a point in the center of the screen, from a width and height of 0, 0 up to full size. The subview won't stretch to fill the parent. It just remains full size the whole way through. I've tried various c...

Adding subviews when Device orientation is face down or face up

Hi, in my project both landscape and portrait orientation is supported, i have a controller view to be added as subview when tap on button. My problem is if user keep device in Face Up orientation or faceDown Orientation and press button weather i have place subview in portrait or landscape mode...? Thanks in advance ...

UIView, hows it working?

Can someone just clarify how UIView works in this context? Is it just part of the view controller (i.e. the view that is part of my ViewController.xib). I was puzzled for a second as it felt like I should have been declaring it somewhere, I wanted to call beginAnimations but was not sure what to call it on. @implementation ViewControlle...

Cocoa Touch - Segmented Controls

How can I get whats been selected in a segmented control? ...

Hide a UIBarButtonItem when in edit mode.

I have a UINavigationController with a UITableViewController which has and two UIBarButtonItems: - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.leftBarButtonItem = self.editButtonItem; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd targ...

Caching to CGLayer slower than redrawing on iPhone

I'm in the process of making a simple drawing program for the iPhone. At the moment, touch events add their location to a list which is connected with a bunch of CGContextAddLineToPoint calls which are redrawn in every call to drawRect. I'm running into performance issues at fairly low numbers of lines (they are transparent, though), s...

Using SystemSoundID throughout my app?

Hi all, Can someone please point me in the right direction... I need to use the same sound (a button press) throughout all view controllers in my app. What is the best way to do this. I have managed to load and play a sound in a single view controller but cannot manage to pass a sound to different viewcontrollers because SystemSoundID i...

Cocoa Touch - Dialogue boxes?

How can i get a plain basic dialogue box in cocoa touch.seems so simple but I can figure it out... Thanks! ...

Can a UILabel be placed over UIPicker component and the text of the UILabel be updated after user picks a new value in the picker?

How are the user's touches detected if i were to use UILabels that are overlayed on each picker component? I understand how to detect the user's touches on the picker, but I need to update the text of the label after the user make changes a picker component value. My method is not being called after I change the values in the picker comp...

MPMoviePlayerViewController Black Screen issue!

I have this code trying to run a video on the iPhone 4 Simulator. The problem is that looks like it loads the player but half a second later loads a back screen on top of the whole application disabling touch and everything, and it looks like it does not play the video also, because I can't hear anything. Any ideas?! MPMoviePlayerView...

How to make UIWebView not act like a browser on the iPhone

My app loads webpages off the internet using a UIWebView. However I'd like to modify the experience so the user won't perceive it to be a webpage. What are some of the things I can do? and how to do it? examples: - Show the page when everything is loaded? - Fade in effect? Suggestions please. ...

How to set margins (padding) in UITextView?

I have a UITextView for text editing. By default, it has a small margin around the text. I want to increase that margin by a few pixels. The contentInset property gives me margins, but it does not change the text "wrap width". The text is wrapped at the same width, and the extra "margin" just causes the view to scroll horizontally. ...

"Next PDF Page" Button Doesn't Call -drawLayer. How to -setNeedsDisplay?

- (void)viewDidLoad { [super viewDidLoad]; page = 2; NSString *pathToPdfDoc = [[NSBundle mainBundle] pathForResource:@"2010_07" ofType:@"pdf"]; NSURL *pdfUrl = [NSURL fileURLWithPath:pathToPdfDoc]; myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)pdfUrl); CGRect pageRect = CGRectIntegral(CGPDFPageG...

NSMutableArray becoming nil after reloadData

In an iPhone app I'm developing, I grab a set of data from a web service, store it in a mutable array for showing in a table, and also store it in core data as backup when there is no network. My array is initialized in application:didFinishLaunchingWithOptions: as follows tableArray = [[NSMutableArray alloc] initWithCapacity:100]; the ...

Cocoa Touch - Floating Image bouncing across screen

I need help with making a UIImageView float on the screen and when it hits the walls it bounces off like collision detection.. I havent gotten further than making the imageview. I need some help.. Any help? Thanks! ...

Cocoa Touch - X,Y coordinates

I want to display a image at random places on the screen. My idea is to generate two random numbers one being a x-value or a y-value and then passing it into a method which displays the image on the xy coordinates provided. But, I dont know how to accomplish that so I need some help with coordinates...Also if you know a better way to ac...

Using BWOrderedManagedObject with NSFetchedResultsController

I would like to use BWOrderedManagedObject to store an array of ordered objects in Core Data, using NSFetchedResultsController for displaying the data. However, all of BWOrderedManagedObject's methods seem to simply return an array of ordered objects; NSFetchedResultsController requires an NSFetchRequest, and the only way to sort an NSF...

UIWebView: Absolute path for images in app documents folder

I have a UIWebView that loads up some html. In it is an img tag, I am saving an image in the app documents folder and I want to display that image within the html, I do so like this NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES); NSString *documentsDir = [paths objectAtIndex:0];...

does animateWithDuration:animations: block main thread?

I have connected the two methods below to separate buttons in my UI but have noticed that after pressing the "VERSION 1" button that I could not press the button again until the animation duration within the method had ended. My understanding was that the animation uses its own thread so as not to block the main application. // VERSION ...