objective-c-2.0

Style: Dot notation vs. message notation in Objective-C 2.0

In Objective-C 2.0 we got the "dot" notation for properties. I've seen various back and forths about the merits of dot notation vs. message notation. To keep the responses untainted I'm not going to respond either way in the question. What is your thought about dot notation vs. message notation for property accessing? Please try to...

Will GNUstep support @property and @synthesize?

I'm working on a Cocoa app with the intention of using it on Windows and Linux using GNUstep. I've been avoiding Objective-C 2.0 features thus far, but I'd really love to start using at least properties. What Google seems to tell me (though I'm having trouble finding much on the subject) is that currently, no Objective-C 2.0 features wor...

How to Make the KeyBoard Disappear while using a UITextView in iPhone

Hi, I am using a UITextView and I am confused about making the keyboard to disappear. Do I need to use some kind of a notification to make it disappear. Thanks ...

Show baseball stats in a table for iphone app

Hi, I want to know how to enter baseball stats manually in a table like hr, RBI AVG with tabs and all that. Is there a table that i can use for my iphone app? I want to use a navigation table and link to a table with the stats in it. ...

Custom UITableView Index Headers on iPhone

I've seen apps that take the UITableView index header (i.e. the thing in the iPod application that separates songs starting in A, B, etc.) and put their own custom image as the background. Such apps are the myStarbucks app and the What's on TV? app. I've looked a little bit through the documentation and there doesn't seem to be a specifi...

iPhone SDK: loading UITableView from SQLite - creating array from SQLite

Hi, this is a follow up forr http://stackoverflow.com/questions/1552944/iphone-sdk-loading-uitableview-from-sqlite I am planning to use following code to load SQL data to the array. Each element of the array will be a class represening each database entry: @interface Row : NSObject { int PK; NSString *desc; } @property int PK...

alloc-init sometimes fails in program

I am bothered by the following code snippet in my program. If I write mo=[[myObj alloc] init]; it fails, but if I write mo=[myObj alloc]; mo=[mo init]; it works. These two methods are supposed to be equivalent but somehow I am messing up. Any light? Clarifications: myObj is the name of a class It fails by trying to allocate for...

Copying a directory off a network drive using Objective-C/C

Hi All, I'm trying to figure out a way for this to work: NSString *searchCommand = [[NSString alloc] initWithFormat:@"cp -R /Volumes/Public/DirectoryToCopy* Desktop/"]; const char* system_call = [searchCommand UTF8String]; system(system_call); The system() method does not acknowledge the specific string I am passing in. If I ...

Reloading Data in a UITableView when pressing a UITabBarItem

I have a UITabBarController as part of my app delegate and I want to trap when the user touches a specific tab (the favourites) and force the table within it to reload the data. What would be best practice in this instance? I have added the UITabBarDelegate protocol to my app delegate and implemented the didSelectViewController method....

Objective-C 2.0 properties: Why both retain and readonly?

I've noticed that some of Apple's examples include both a retain and readonly modifier on properties. What's the point of including retain if no setter gets generated when we're using the readonly modifier? Example: @property (retain, readonly) NSString *title; from the AnimatedTableView sample. ...

Objective-C property assignment returns the assigned value?

Say I have the following: @interface MyClass : NSObject { NSString* _foobar; } @property (nonatomic, retain) NSString* foobar; @end @implementation MyClass @dynamic foobar; - (void) setFoobar:(NSString*)fbSet; { [_foobar release]; _foobar = [fbSet retain]; } - (NSString*) foobar; { return _foobar; } @end Then: MyClass* mcInst = [[[M...

UIApplication sharedAppication error: program seems to be accessing wrong file

in my MainViewController implementation, I need to access variables from two different classes. one of the classes is the AppDelegate and the other is the FlipsideViewController. the way I accessed these was through this code: -(void)someMethod { MyApplicationAppDelegate *appDelegate = (MyApplicationAppDelegate *)[[UIApplication sharedA...

Which NSTextView is the First Responder?

I'm working on a Cocoa programming exercise, and I need to be able to determine which of two NSTextView objects is currently being edited. I think it's something to do with finding the first responder and checking to see if it's equal to one text field or another, but I can't quite get it to work. Any help would be appreciated. ...

When I refer to programming in Objective-C should I include the 2.0?

This may be subjective but if I'm writing some code in Objective-C 2.0 and write about it on for example Twitter or a blog. Should I refer to it as Objective-C 2.0 or can I just call it Objective-C? ...

How to programmatically retrieve table selection and table row for Core Data app?

I'm trying to make a Core Data app in which when you select one "Player" in a TableView, and a list of all teammates appears in a second tableView, with a column for how many times those two players have played on the same "Team" (another entity). This has got me completely stuck, because while I know how to fill up a table from a norma...

Objective-C 2.0 dot notation - Class methods?

Please note I am specifically referring to the fact that dot notation is being used on class methods, not instance methods. Out of curiosity, I wanted to see what would happen if I tried to use Objective-C 2.0 dot notation syntax on a class method. My experiment was as follows: #import <Foundation/Foundation.h> static int _value = 8; ...

objective-c 2.0 properties and 'retain'

Stupid question, but why do we need to use 'retain' when declaring a property? Doesn't it get retained anyway when it's assigned something? Looking at this example, it seems that an object is automatically retained when alloc'ed, so what's the point? #import "Fraction.h" #import <stdio.h> int main( int argc, const char *argv[] ) { ...

Does Objective-C support Mixin like Ruby?

In Ruby, there's Modules and you can extend a class by "mixing-in" the module. Module myModule def printone print "one" end end Class myClass extend myModule end theOne = myClass.new theOne.printone >> one In Objective-C, I find that I have a set of common methods that I want a number of Class to "inherit". What other wa...

Error "Create a concrete instance!"

Hey All, I've got another problem in the same code... I'm getting this error: initialization method -initWithCharactersNoCopy:length:freeWhenDone: cannot be sent to an abstract object of class NSString_RegEx: Create a concrete instance! But I don't understand the error or what I should do... edit: NSString *pageContent = [[NSStr...

Data sources and NSTableView

I know that table sources need a data source to hold the data that the tableview will display. Lets' say that I'm going to make my AppController be the data source of my tableview and that I make the connection in interface builder. My question is since my actual data is going to be stored in an array,let's call it myArray, when I set th...