cocoa-touch

Difference of 2 NSArray's for animated insert/delete in UITableView

At some point in my Application, I have an NSArray whose contents change. Those contents are shown in a UITableView. I'm trying to find a way to find the diff between the contents of before and after of the NSArray so i can pass the correct indexPaths to insertRowsAtIndexPaths:withRowAnimation: and deleteRowsAtIndexPaths:withRowAnimation...

How to follow user location with MapKit

I'm using MapKit to display the user's location relative to pins around them. I'd like to be able to mimic the functionality that Maps provides via the crosshair button in the lower left-hand corner of the screen. I'm already aware that MapKit provides a CLLocation object with the user's location via MKUserLocation, I just wanted to seek...

Why I cannot get correct class of a custom class through isKindOfClass?

Hi, I've created a custom class AnimalView which is a subclass of UIView containing a UILabel and a UIImageView. @interface AnimalView : UIView { UILabel *nameLabel; UIImageView *picture; } Then I added in several AnimalView onto the ViewController.view. In the touchesBegan:withEvent: method, I wanted to detect if the touch...

Can I use an NSDecimalNumber anywhere that an NSNumber is expected?

NSDecimalNumber is a subclass of NSNumber, and from what I can tell, it implements all of the NSNumber methods as expected for an NSNumber instance. Given that, is it ok to give NSDecimalNumbers to any code that is expecting an NSNumber? The only possible issue might be code that checks that an argument is an instance of NSNumber, but ...

How can I have clickable links in UILabel while drawing text with a shadow?

I need to do data detection of website URL's in live chat and display them in a UILabel NOT UITextView. They need to be clickable and will open a in-app browser. We have tried Craig Hockenberry's code, three20, and making our own, all of which didn't work. We need to use UILabel to take advantage of shadows. Anyone know what to do? Help!...

How to display user location in mapkit?

I'd like to display the blue pulsing dot for a user's location. I'm doing this: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ //some other stuff here [self.mapView setShowsUserLocation:YES]; } But I eventually get -[MKUserLocation establ...

iPhone SDK - Load nib offscreen and save as image to Camera Roll

So I have a nib I've created that's basically just a view that's larger than the iPhone screen size. Within it is a UIImageView, set up as outlet "framedImage". In my code, I want to initialize the nib offscreen, set framedImage's image property to a UIImage object I already have created in the code (called "myProcessedImage"), then save...

Extracting a URL from within a string

My app receives numerous text strings which may or may not contain a URL anywhere within the string. What would be the best method to extract a URL from within a string? Thank you. ...

iPhone - Reset UINavigation Controller

Hey there, I have a UINavigationController inside a UITabBarController. When a user presses the first tab, I want to reset the navigation controller back to the first screen instead of displaying whichever view they last selected in the navigation controller. Is there an easy way to reset the stack? Thanks, Howie ...

Method called when dismissing a UIViewController?

Is there a general best-practices way of being notified when the current view controller is being dismissed (either popped or dismissModalDialog'd)? I can't use -viewWillDisappear:, since that also gets called when another viewController is pushed atop the current one. ...

Create a UIView Subclass that calls a delegate function whenever it's parent viewController appears?

EDIT 2: I now think the best soluton is to create ListeningView.h that just includes a ListeningView protocol, instead of subclassing ListeningView (since we can't do multiple inheritance in Obj-C). Then, you still need ListeningViewController as well. EDIT: Ok, I figured out what the approved idiom is here. I should subclass UIViewCont...

Why does this JSON fail only in iPhone?

I'm using the JSON framework from http://code.google.com/p/json-framework. The JSON below fails with this error: -JSONValue failed. Error trace is: ( Error Domain=org.brautaset.JSON.ErrorDomain Code=5 UserInfo=0x124a20 "Unescaped control character '0xd'", Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x11bc20 "Object value...

iPhone: NSAlert Delegate Method Never Called

Hello, I have implemented an NSAlert but the delegate method didDissmissWithButton is never called. This code evokes the NSAlert: NSString *title = [NSString stringWithFormat:@"Keine Internetverbindung"]; NSString *alertMessage = [NSString stringWithFormat:@"Es konnte keine Verbindung zu www.sip.de aufgebaut werden!"]; ...

Cocoa Touch text view with aligned, justified text

I am trying to create a textview with predefined height that will contain justified text. When entering the text into the view, I need to be able to check when the view is full. How would I do this? Core Text? I am using sdk-3.2. ...

Core Text examples for iPhone/iPad

I am looking for a Core Text example for iphone/ipad but with little luck. Any leads would be appreciated. ...

What format does NSKeyedArchiver save?

When I use NSKeyedArchiver is the data that is written a *.plist, I have seen some examples where people have the output file down as *.txt or even without an extension at all? -(void)saveCore { NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:...

UITableView : detecting click on '-' button in edit mode

Hi all, On my iphone app, I have a UITableView in edit mode, containing custom UITableViewCell. I would like to detect when user has clicked on the left button of each cell (minus circular red button, the one that is animated with a rotation), just before the "Delete" button appears. I would like to be able to change my cell content in...

Creating a horizontal line

I have two labels that are stacked. If I want a horizontal line between them, is there any other way besides using an image with a UIImageView? ...

How to map an property of ClassA to one of SuperclassA?

I have a class named SuperclassA, and an class named ClassA. ClassA inherits from SuperclassA. SuperclassA has got an property called something, so a very generic not-much-saying name. In ClassA, I want to have an property which maps to that something of SuperclassA. How could I do that? I want to make absolutely sure that any access t...

initWithCoder not working as expected?

Does this seem right, the dataFilePath is on disk and contains the right data, but the MSMutable array does not contain any objects after the initWithCoder? I am probably just missing something, but I wanted to quickly check here before moving on. -(id)initWithCoder:(NSCoder *)decoder { self = [super init]; if(self) { [...