cocoa-touch

how to swap images using Cocoa Touch

I am trying to build 15-puzzle game. Here I need to swap a blank image with a clicked on image. I would like to know how to swap these images. I have stored the co-ordinates of the two images,but don't know the format to identify the blank image and then set its origin to clicked image. ...

How to validate an url on the iPhone

In an iPhone app I am developing, there is a setting in which you can enter a URL, because of form & function this URL needs to be validated online as well as offline. So far I haven't been able to find any method to validate the url, so the question is; How do I validate an URL input on the iPhone (Objective-C) online as well as offli...

is it possible to use AVAudioRecorder alongwith MPMusicPlayerController?

Hello all, When a song from iPod chosen using MPMediaQuery is playing with MPMusicPlayerController, is it possible to record a clip of the song using AVAudioRecorder? ...

Tinting iPhone application screen red

I'm trying to place a red tint on all the screens of my iPhone application. I've experimented on a bitmap and found I get the effect I want by compositing a dark red color onto the screen image using Multiply (kCGBlendModeMultiply). So the question is how to efficiently do this in real time on the iPhone? One dumb way might be to grab...

Object Makeup, how its constructed?

These are fairly simplistic questions, but something that I wanted to get right in my head before continuing... @interface BasicTire : NSObject { } @end @interface SnowTire : BasicTire { } @end When you call [SnowTire init] the included [super init] calls [BasicTire init] which in turn calls [NSObject init]? (i.e. a cascade running...

Can I set a UILabel to expand to fit an arbitrary amount of text?

This question is more for development purposes and would never be used for a shipping app. I need to do a quick and dirty UILabel whose text field I can point to a really, really, long string. Really long. I've ben futzing in IB and can't figure out the correct magic handshake to allow a UILabel to balloon to a really large size. Does an...

Detecting horizontal swipes in a UIScrollView with a vertical scroll.

I have a UIScrollView that's around 600pixels in height and 320 in width. So I'm allowing the user to scroll vertically. I'm also trying to capture horizontal swipes on the view. The problem seems to be that when a user swipes horizontally with some accidental vertical movement, the UIScrollView scrolls and my touchesEnded delegate me...

Difference Between Methods of Switching Tabs

Is there a difference between these two lines of code? self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:1]; and self.tabBarController.selectedIndex = 1; My app just crashed on the top statement so it might have some memory issues. Are there any advantages of one method over the ot...

how to add sender into an HTML coded email?

I need to send an email from my iPhone app but the name of the sender needs to be included within the body. I do not know how to do that. ...

How do I get rid of the warning <Class> may not respond to <Selector>?

The below code behaves as expected however the compiler keeps telling me this: warning: 'StatusViewController' may not respond to '-beginLoadingThreadData' How do I get rid of that warning and most important why xcode believes that is the case? here is my code: [self beginLoadingThreadData]; // called in the loadDidView block - (void...

Question for Core Data experts regarding abstract entities and inheritance relationships

My exact model is complicated to explain, so say that I'm modeling fruits and their seeds in Xcode's Core Data modeler. Here's some "psuedo-coreData-code": abstractEntity Fruit attribute sweetness relationship Seed abstractEntity Seed attribute shape concreteEntity Apple inherits Fruit concreteEntity Orange inherits Fruit concreteEn...

In Cocoa, how to obtain the current hours and minutes in an efficient way?

I want to display current time in my iPhone app using my own custom graphics. What's the most efficient way to get the hours, minutes and seconds info? I thought about using NSDateFormatter to get each part but this seems to be too CPU intensive. ...

Attach version number to NSKeyedArchive

I'm using NSKeyedArchiver to write out an NSDictionary of my app's data to the filesystem. NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; [archiver encodeObject:myAppsDictionary forKey:kDataKey]; [archiver finishEncoding]; BOOL success = [dat...

Accessing objects in NSMutableDictionary by index

To display key/values from an NSMutableDictionary sequentially (in a tableview), I need to access them by index. If access by index could give the key at that index, I could than get the value. Is there a way to do that or a different technique? ...

Is there a unique ID for each iPhone / iPod Touch?

Hey, Is there a unique ID like the mac address for each iPhone / iPod Touch? Do I have to ask the user for permissions to transmit such a unique id? ...

NSLog with CGPoint data

I have a CGPoint called point that is being assigned a touch: UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; I want to get the x coordinate value into my console log: NSLog(@"x: %s", point.x); When I use this, log output for this is: x: (null) I have verified that point is not null when this i...

How to base class behaviors on typedef enums, the way Apple does in Objective-C?

Kind of a weird newbie question...I want to use typedef enum declarations in one of my classes . This particular class gets used by other classes, where a client class might say something like "set your style to Style1 (enumerated type)". Then the target class's behavior would change accordingly. This is analogous to the way that UITa...

Stacking order of UIActionSheet

While my app is displaying a UIActionSheet, I send startUpdatingLocation to the CLLocationManager. This results in a Location Warning, if the user has not yet agreed to letting my app use her location. Now, the problem is, that the UIAlertView that the Location Manager displays pops up behind my UIActionSheet, and thus the user can not ...

-viewDidLoad not called in subclassed UIViewController

Have patience with me, I'm still learning Cocoa Touch. Other -viewDidLoad not being called question was unrelated to my issue, I did search. I have FooViewController, a UIViewController subclass. FooViewController.xib has its File's Owner set to FooViewController. Additionally, I have Main, whose App Delegate is MyApplication and whose...

What's the quickest way to prepopulate CoreData?

My iPhone app uses CoreData and I would like to prepopulate the database. What's the best way to go about this? ...