cocoa-touch

Control flow in Objective-C

I am working through Beginning iPhone Development. In the book is this method: -(void)playWinSound { NSString *path = [[NSBundle mainBundle] pathForResource:@"win" ofType:@"wav"]; SystemSoundID soundID; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID); AudioServicesPlaySystemSound (soun...

Getting a view to respond to a sibling's touch event / message

I'm sure there is a correct way to do this, I'm new to objective-c and cocoa touch so I don't know what it is. I have an application that has a (simplified) view hierarchy of Window --Button --Button --Subview --Sub-Subview What I'm trying to do is get the subview to do something in response to a touch event on one of the b...

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...

ASIHTTPRequest: Receive delegates from several requests within a network queue

Hi, I use ASINetworkQueue to send two requests, which are in a queue. My problem is, that I'm not able to receive notifications when a request fails/is done. Code: [networkQueue cancelAllOperations]; [networkQueue setShowAccurateProgress:YES]; [networkQueue setUploadProgressDelegate:self.progressIndicator]; [networkQueue setDel...

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 ...

How do I edit an interface builder object programmatically?

I created a label using Interface Builder, and now I want to set the background color of the label using code instead of IB's color picker. (I want to do this so that I can define the color using RGB and eventually change the colorspace for the label.) I'm in cocoa. How do I edit the attributes of an IB object using code? My code lo...

Core Data XML import/export of single object

With Core Data, specifically on Cocoa Touch, is it possible to export and import individual objects in XML format (irrespective of the underlying store format, ideally)? I'm asking this because I'm using Core Data to manage my object graph anyway, and I need to send and receive my objects in XML format with HTTP. So it would be conveni...

How do I convert RGB into HSV in Cocoa Touch?

I want to set the background color of a label using HSV instead of RGB. How do I implement this into code? Code: //.m file #import "IBAppDelegate.h" @implementation IBAppDelegate @synthesize label; { self.label.backgroundColor = [UIColor colorWithRed:1.0f green:0.8f ...

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...

iPhone SDK 3.0 in-app email - changing navigation bar tint color

My App uses the iPhone SDK 3.0's new in-app email feature. I want to change the tint color of the email UI to black and make it translucent. I tried the following code, /* picker.navigationController.navigationBar.tintColor = [UIColor blackColor]; picker.navigationController.navigationBar.translucent = YES ; */ But it's changing the...

Loading a view controller from viewDidLoad

Hello I want to create a tabbar application in iPhone using X-code.I have one splash screen and then after that I have my Home Screen where I want to create tabbar in that view. so, I create a tabbar in my ViewDidLoad method. - (void)viewDidLoad { NSLog(@"in Home"); tabBarController = [[UITabBarController alloc] init]; ...

animate resize UIScrollView so that content would stick to the bottom

When keyboard appears, i resize my scrollview, but the content inside sticks to the top. I want to change behaviour so that it would stick to the bottom, so it should scroll up. (I am writing a chat client, so the content should be always scrolled to the bottom) I tried changing Autoresizing mask for the content of the scrollview: [myIm...

disable UIViewController content animating on iPhone rotation

Hi! I need to implement behavior of my UIViewController subclass like in standart iPod.app: when device rotated from portrait to landscape, content of UIViewController stay's still and new view add's above it. The problem is that, when set - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { ...

Displaying an image in UIWebView

I'd like to dislay an image in UIWebView using <img src="imageInBundle.png"/> The above image is in my bundle. I load it, along with other HTML in a string, like this: [myWebView loadHTMLString:htmlString baseURL:[NSURL URLWithString: @"http://www.abc.com"]]; However, I just get a blue box with a white question mark. Is there som...

Why does Apple say iPhone apps use MVC?

Apple describes the architectural pattern used by iPhone apps as MVC. However, virtually no modern application uses MVC (as described by Trygve Reenskaug). Modern operating systems, including iPhone OS, inherently handle controller responsibilities. What is mistakenly and commonly referred to as MVC is actually MVP. Why does Apple sa...

How to choose what code to put in a View vs. a ViewController?

In Xcode, the Utility Application template makes a project with: MainView, MainViewController and FlipsideView, FlipsideViewController In my app, the two views correspond to the main UI and a preferences screen. Obviously I want the prefs to be reflected in the main UI and persisted to disk to remember settings. I know how to do that...

Drawing a UIImage on top of another within one UIImageView

I have several different color block images that are reused in my game many times (its a simple rectangle for a puzzle game). I would like to apply a transparent overlay to each one of these images on the fly (a symbol for the puzzle block) which can be one of several different images. Is there a "best" way to get this done? Creating a s...

UILabel Strikethrough

Is it possible to stikethrough a UILabel at all? I can't seem to find the option... ...

UILabel: vertical alignment

Hi, I have an UILabel with two lines. Sometimes it's text is short. Then the text gets displayed in the center (vertically) of the UILabel. How do I align my text at the top (vertically)? Regards... ...