objective-c

Multiple views and source list in a Core Data app

I'm working on my first major Cocoa app for an undergraduate research project. The application is document-based and uses Core Data. One of the entities is an abstract entity, Page. Page is parent of several types of pages: ie PageWithHeaderAndFooter, PageWithTwoColumns, BasicPage etc. Page has attributes, such as title and author, that...

Restrict UITextField size

How can I limit the number of characters in a UITextField? I.e if I limit it to 10 characters, the user will be unable to enter more than 10. Also I want to prevent him from entering some special characters like +, =, etc. How would I do this? ...

Handling the return value of object_getIvar(id object, Ivar ivar)

1) object_getIvar(id object, Ivar ivar) returns an 'id' if the Ivar is an object eg. if the variabe is an NSString, presumably the id = NSString which contains the value. Is that correct? Or what do I need to do to access the value of the Ivar. 2) if the Ivar is a float/int etc. what will get returned and how do I convert it into someth...

How to set up single array or dictionary for use in multiple datasources?

I have multiple TableViewDatasources that need to display list of objects form same pool depending of certain property. E.g. object.flag1 is set- it will show up in TableView1 object.flag2 is set- it will show up in TableView2 The obvious way would be to have separate arrays for each TableView, But same object may appear in different...

Unit testing Cocoa User Interface

Hi All, Anyone please let me know some links or examples for Unit testing user interface code. Is there a complete example app on that. Thanks in Advance, Bhanu ...

Making the Name of the App appear in the Menubar (top-left corner) when the App is LSUIElement.

How would I make the name of the app appear here ( like with a normal app )… … when the app is an LSUIElement. My Problem is that when the App is LSUIElement the name is not by default displayed in the menu bar like an normal app. Basically all I want LSUIElement to do is to hide the dock icon not the name in the menu bar. For those...

In my code how to launch application responsible for an UTI

My Mac OS X application receives a file over the network (in this case, text/x-vcard). In my code, how can I open the related application (typically the Address Book) without hard-coding paths or application name so that it processes the file ? ...

How do I get the int value from object_getIvar(self, myIntVar) as it returns a pointer

if the variable in object_getIvar is a basic data type (eg. float, int, bool) how do I get the value as the function returns a pointer (id) according to the documentation. I've tried casting to an int, int* but when I try to get that to NSLog, I get error about an incompatible pointer type. ...

Fetched Properties, cross store relationships

Hi folks, I've got a store that is synchronized externally and a store that is unique to the application instance, so in order to cleanly differentiate the two I want to have some join entities between them and then resolve through to the entities between using Fetched Properties, as "discussed" in the Core Data Programming Guide: deve...

What are some of the different names of terms and concepts in Objective C as compared with Java?

I was hoping to make a list of some of the differences in terms between java and objective c to abate my confusion. It makes explaining my difficulties easier when I know what things are called. For example: null - nil this - self map - dictionary (not even quite sure about this one) What I'm looking for are similar comparisons or c...

Instance variables of custom classes in NSManagedObject subclass

I have written a class Foo, and would like to include a Foo object as a property for an NSManagedObject subclass. Is this possible? Can Core Data store information other than strings, booleans, integers, etc.? ...

tableView footer strange behavior

Given: I have a bit of a "pop up" view that I put over my tableView within my UITableViewController. I put it there like this: [self.navigationController.view addSubview:self.hoverView]; Problem: I cannot see this hoverView when I add a tableView footer view. Seemingly unrelated yes? self.tableView.tableFooterView = [[UIView alloc]...

Creating Core Foundation classes

Since I can't seem to find any documentation on this subject, is it possible to create your own Core Foundation "class"? (classes as in ones that can be used with CFRetain() and CFRelease) I want to take advantage of the polymorphic capabilities and object inspection built into Core Foundation without the overhead of Objective-C or creat...

Best language suited for scanning many files for a keyword (called from a Cocoa app)?

I'm writing a Cocoa app for Leopard that, given a directory of text files, will scan through them, looking for a search pattern (let's pretend they're source files and I just want to find C comments). It will then present the results to the user. While I think I could certainly do this with Cocoa, it feels like it's really meant to be h...

iPhone Dev - Using a getter in the same class

(Just to let you now, I'm learning to develop for iPhone with a book I got called Beginning iPhone 3 Development: Exploring the SDK, and I do not use Interface builder) Is there ever a reason to use the getter in the same class, when a private member is visible? Like in Foo.h, having NSObject *myObj; ... @property (nonatomic, retain)NSO...

% operator for time calculation

I am trying to display minutes and seconds based on a number of seconds. I have: float seconds = 200; float mins = seconds / 60.0; float sec = mins % 60.0; [timeIndexLabel setText:[NSString stringWithFormat:@"%.2f , %.2f", mins,seconds]]; But I get an error: invalid operands of types 'float' and 'double' to binary 'operator%' And...

object_getInstanceVariable works for float, int, bool, but not for double?

I've got object_getInstanceVariable to work as here however it seems to only work for floats, bools and ints not doubles. I do suspect I'm doing something wrong but I've been going in circles with this. float myFloatValue; float someFloat = 2.123f; object_getInstanceVariable(self, "someFloat", (void*)&myFloatValue); works, and myFloat...

Tips for converting an iPhone 2.x app to 3.0 with Core Data

I have an app developed for iPhone OS 2.x. For the obvious reasons, the model classes in that app were written without Core Data. Now that 3.x is available, I'd like to know what are some of my options for taking my existing model classes and rebuilding them with Core Data. I do many things with my models besides the obvious, such as s...

Objective C release, autorelease, and data types

I'm new to memory managed code but I get the idea pretty well. On taking my app through the leaks tool in XCode, I noticed I only had to clean up my custom objects, but not dynamically created arrays for example, so I figured those data types are autoreleased - makes sense since I only had to release the arrays I used as properties that...

iPhone: Cannot find resource

Hi, In my app I want to copy a file from my bundle to documents directory in order to modify it. Here's my code: +(BOOL) copyDB: (NSString*) pdbName { NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; NSString *dbPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, ...