objective-c

Reloading a view when back button is clicked from uinavigationbar

Application shows information about planets, their moons, and etc. It shows a list of planets, let user select a planet and see its details and then bookmark/unbookmark it. I have a view which shows user the details of selected planet, it also contains a add/remove bookmark button. If user clicks that button, that bookmark is added/remov...

What does .h and .m stand for?

Exact duplicate: Why do Objective C files use the .m extension? I'm thinking .h stands for header. I suppose .m could stand for main, but I don't know. Do any of you actually know this? Just to clarify, I know what goes in which file, i.e. I know the purpose of each filetype, I'm just curious if the filetype symbol has a meaning. ...

Releasing a property (Objective-C)

I have a @property which is defined like this : @property (nonatomic, retain) name; In a function I parse some xml and set the name property. My question is should I explicitly release previous retained instance before retain a new one ? For exemple : myObj.name = [otherObj getName]; // retain count +1 .. myObj.name = [otherObj ge...

Why doesn't UIView.exclusiveTouch work?

Hi! In one of my iPhone projects, I have three views that you can move around by touching and dragging. However, I want to stop the user from moving two views at the same time, by using two fingers. I have therefore tried to experiment with UIView.exclusiveTouch, without any success. To understand how the property works, I created a br...

How do you toggle the status item in the menubar on and off using a checkbox?

I have already created a status item for the menu bar but I would like to add a checkbox to make it able to be toggled on and off. So when the check box is checked the status item is displayed and when the checkbox is not checked it is not displayed. What code would i need to do this? ...

Is there a difference between an "instance variable" and a "property" in objective-c / cocoa / cocoa-touch?

I'm not very sure about this. I think that an "property" is an instance variable that has accessor methods, but I might think wrong... ...

Cocoa NSView changing autosizing properties

Using interface builder you can select the corners an object should stick to when resizing. How can you do this programatically? ...

How do I choose which Python installation to run in a PyObjC program?

I use Python 2.6 more than I use Leopard's default python installation, so I have it set as my main Python installation. But I'd rather use the default Python for a PyObjC program I'm working on. Is there any way to specify to only use it instead of Python 2.6? ...

Bounce -> Crash

Im working on an iphone app that uses rss. When I scroll my UITableView, if i bounce the bottom too much my app crashes and i get TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION any suggestions? Here is my code: http://pages.stern.nyu.edu/~abc329/SS/ Here is the error I get: warning: Unable to read symbols for "/System/Library/Frameworks/UIKit...

How to do Core Data queries through a relationship?

I'm messing around with Core Data, and I am sure I am missing something obvious, because I cannot find an example that at all resembles what I am trying to do. Let's say I'm playing around with a DVD database. I have two entities. A Movie (title, year, rating, and a relationship to Actor) and Actor (name, sex, picture). Getting all the...

Initialize NSMutableArray: [NSMutableArray array];

If you initialize an NSMutableArray with NSArray's convenience method as above, do you get an NSArray or an NSMutableArray? Any consequences? (I know that NSMutableArray has "arrayWithCapacity:, I'm just curious) ...

Is there an easy way to iterate over an NSArray backwards?

I've got an NSArray and have to iterate over it in a special case backwards, so that I first look at the last element. It's for performance reasons: If the last one just makes no sense, all previous ones can be ignored. So I'd like to break the loop. But that won't work if I iterate forward from 0 to n. I need to go from n to 0. Maybe th...

[super viewDidLoad] convention

I see some example code with [super viewDidLoad] called before your implementation and after your implementation. I know you don't always have to call super (as seen in many other discussions). When you do call it, is it expected before or after you code? This could have consequences depending on what super's implementation does. Thou...

Is subclassing in Objective-C a bad practice?

After reading lots of blogs, forum entries and several Apple docs, I still don't know whether extensive subclassing in Objective-C is a wise thing to do or not. Take for example the following case: Say I'm developing a puzzle game which has a lot of elements. All of those elements share a certain amount of the same behaviour....

How do I upload custom images to my tab bar in the iPhone SDK?

How do I upload custom images to my tab bar in the iPhone SDK? I uploaded an image, added it to resources, and tried to make it the image for a tabbar item. This is what happened: http://www.mediafire.com/download.php?tmn1xtnmjhz Thanks ...

converting an float to NSDate

I want to convert a float to a NSDate I converted a NSDate into a float using this: // Turn the date into Integers NSCalendar *calendar= [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSCalendarUnit unitFlags = NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; NSDateComponents *dateComponents ...

What does "@private" mean in Objective-C?

What does @private mean in Objective-C? ...

How to handle Objective-C protocols that contain properties?

I've seen usage of Objective-C protocols get used in a fashion such as the following: @protocol MyProtocol <NSObject> @required @property (readonly) NSString *title; @optional - (void) someMethod; @end I've seen this format used instead of writing a concrete superclass that subclasses extend. The question is, if you conform to th...

Creating a custom text-drawing view

Hi, I am creating a syntax highlighter for the iPhone and in order to display text with multiple formats, I have sub-classed UIView and modified the drawRect: method so that each line is displayed with the proper syntax highlighting (highlighting is done earlier with RegEx, text is drawn with CGContextShowTextAtPoint() one line at a tim...

Move focus to newly added record in an NSTableView

I am writing an application using Core Data to control a few NSTableViews. I have an add button that makes a new a record in the NSTableView. How do I make the focus move to the new record when this button is clicked so that I can immediately type its name? This is the same idea in iTunes where immediately after clicking the add playli...