cocoa-touch

Get size of image without loading in to memory

I have several .png images (ETA: but the format could also be JPEG or something else) that I am going to display in UITableViewCells. Right now, in order to get the row heights, I load in the images, get their size properties, and use that to figure out how high to make the rows (calculating any necessary changes along the way, since mo...

Generic Xcode usage questions

I have 3 general questions related to the usage of xCode. Any help would be greatly appreciated please: Whenever I open documentation, the left content/index column is always small and I have to drag it wider. Is there a way to permanently set its size? Is there a way to perform a wildcard search and replace e.g. I have 3 lines: var1Le...

Near People With Core Location

Hi Everyone: I am wondering if there is some way to find people that are near you using data supplied by the Core Location Framework. If you can get the other person's CLLocation's description attribute, I assume there must be some way to compare this in terms of location to your location. Thanks for any help. ...

Properties and Instance Variables in Objective-C

I'm rather confused about properties and instance variables in Objective-C. I'm about half-way through Aaron Hillegass's "Cocoa Programming for Mac OS X" and everything is logical. You would declare a class something like this: @class Something; @interface MyClass : NSObject { NSString *name; NSArray *items; Something *so...

Why doesn't UIView (or it's subclasses) adopt the NSCopying Protocol?

Can a Cocoahead please explain why UIView and it's sub classes don't adopt the NSCopying Protocol? I can see, philosophically, why UITouch would not be copy compliant, as it's a very temporal object. By UIView, and it's subclasses, especially UIButton, seem like they should be able to be copied. Certainly Apple has good reasons for do...

Create VCards with iPhone Address Book Contacts

Hi Everyone: I am wondering if there is some way to create and send VCards based upon the iPhone Address Book information from my own app. On the Mac, there is some easy function in the built in app to do this, but I have not seen something on the iPhone like this. So, is there some framework or otherwise that enables me to turn conta...

How can I add a line break for the text of a UIButton?

Title pretty much says it all, I want to know how to have a multi-line label on a UIButton. ...

Showing an image programmatically in tableview cell

I'm doing this to load an image into a tableview cell: UIImage *image = [UIImage imageNamed:@"myimage.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; imageView.frame = CGRectMake( 0, 0, cell.frame.size.width, cell.frame.size.height ); imageView.contentMode = UIViewContentModeScaleToFill; [cell addSubview:image...

Process touches behind the UINavigationBar

In my application, I'm displaying a fullscreen image in a 320 x 480 frame. After I display the image, I fade the navigation bar out to allow the user to see the whole picture. When the user taps in the area where the navigation bar was, I would like to bring the navigation bar back. This is very similar to what happens in the iPhone Pho...

How to make a UITextView scroll horizontally as the user types?

This seems like it should be simple but I can't work out how to do it. I've created a UITextView in interface builder. It doesn't sit in a table cell or anything fancy like that. What I'd like to do is have the UITextView scroll itself to the left when the user has typed their way all the way to the right margin. At the moment it jus...

Key value Observing during UIView Animations

Hi, I'm animating the center property of a view in my program. During the animation, I need notifications when center hits a particular value. I tried adding the myself as a key value observer for the center property of the view . However, I only get notified when the animation begins. So I'm unable to detect if/when the object passes ...

Cocoa-Touch, NSManagedObject: Exception when setting a property.

I have a NSManagedObject subclass, created by the XCode model interface. This class has some NSString and NSNumber members, and a NSDate member. When I try to set the NSDate member, I get the following exception: 2009-10-12 21:53:32.228 xxx[2435:20b] Failed to call designated initializer on NSManagedObject class 'Item' 2009-10-12 21:53:...

Replace " " character in an NSString with "\ " (to create a Unix path)

Using the following doesn't work: - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement By doesn't work I mean does not do any replacement what so ever. It returns the same exact string. Is there a convenience method to do this? Similar to: - (NSString *)stringByReplacingPercentEsca...

Black corners on UITableView Group Style

Hi, I have a problem where my UITableView (group style) has a black "tip" above it's rounded corner. I'm setting up the background of the tableview like so: [meetingTableView setBackgroundColor:[[UIColor alloc] initWithPatternImage:[[UIImage alloc] initWithContentsOfFile:@"background.png"]]]; And my table view ends up looking like th...

How do you animate the resizing of a tableView without its rows/subviews getting clipped?

EDIT: I originally asked this question in regards to general view resizing, but I realize now that it's something much more specific to tableViews. Say that a tableView originally has a frame of (0 0, 320 460), i.e., it fills an entire iPhone screen. In order to resize the tableView's height and animate the resize, I map the following ...

UIToolbar with images and titles like UITabBar

Hello, is it possible to create a UIToolBar containing UIBarItems with both, images and titles for better explaining the function behind the item? A UITabBar is designed to select 1 of n items. The current item is highlighted. This is not what I need. I'm needing to call a function without selecting the current toolbat item! ...

Cocoa touch - problem with button-viewController connection

Hello, I'm very new to cocoa touch and am stuck on a problem that doesn't seem to have a google solution. I have added a view to my application, and this view has a button on it. When the button is pressed I want the callback to perform an operation. My problem is that the callback isn't being called. I created the view in Interface...

Cocoa-Touch, Core Data: Compiler cannot find the NSManagedObjectContext (+ other core data classes)

I have an application that will use Core Data. I've added the Core Data framework to the linked library list in XCode. In one of my classes, I try to set up the NSManagedObjectContext along with the other required classes as folows: @interface MyClass : NSObject { NSManagedObjectModel *managedObjectModel; NSManagedObjectContext...

Cocoa-Touch: How do I see if two NSDates are in the same day?

I need to know if two NSDate instances are both from the same day. Is there an easier/better way to do it than getting the NSDateComponents and comparing day/month/year? ...

Cocoa-Touch, Core Data: Getting exception when trying to insertNewObjectForEntityForName:inManagedObjectContext:

I'm following this how-to to implement Core Data storage in my app: I have a Model.xcdatamodel which defines a Something model. I've used XCode to generate a class for that model. I've imported the class in my .m file where I'm trying to: Something* s = (Something *)[NSEntityDescription insertNewObjectForEntityForName:@"Something" inM...