objective-c

NSMetadataQuery end of search

Is there a way to know whether or not the NSMetadataQuery is still gathering metadata (or is still running)? I mean,in my program I set the search scope to a single directory; now, the query is simple so it takes a few time to collect all the data. How can I know if he finished or not? ...

Where to put declaration in Objective C

I have a file1.h file1.m file1.xib the xib has a blank screen with a label on it. I have another file that does some arbitrary calculation and will update the label as the calculation loops. Where should I declare the UILabel * value in file1.h or the file that does the calculations? Thank you drive around. ...

Why is a UIButton is overriding UITapGestureRecognizer?

I have a parent UIView with 2 subviews: a UIButton and a UIScrollView with a UITapGestureRecognizer implemented. The UITapGestureRecognizer is used to zoom in and out the scrollview and the button is used to show/hide some text. My problem is that once I've used the UIButton, the UITapGestureRecognizer is no longer functioning. Also, t...

Why is a BOOL a signed char?

The other day a user reported a bug to me about a toolbar item that was disabled when it should be been enabled. The validation code (simplified for your benefit) looked like: - (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem { NSArray* someArray = /* arrray from somewhere*/ return [someArray count]; } It took me a...

Objective-C Coding Standards?

I've been teaching myself Objective-C for about 6 months and like using the language a lot. However I haven't found any good coding standards, so the code I write always ends up looking like an inconsistent mess. Things like naming conventions carry over just fine, but spacing, indentation and the (impossible?) 80 character line-width a...

Objective C / iPhone: How do I extract the actual unicode date format strings for the current region?

I am completely new to objective c and iphone development, so please be gentle (just started looking at the code for the first time tonight). According to this site: http://iphonedevelopertips.com/cocoa/date-formatter-examples.html there is a class that handles formatting, which takes in a set of constants/enums (e.g. NSDateFormatterSh...

How to sort an array of an array of objects by those objects attributes

If have an NSMutableArray foo of an NSMutableArray bar of objects. Each of the objects have a property that is a numerical value. In each NSMutableArray bar I want to sum this numerical property of each object. Then I want to sort the NSMutableArray foo by this sum. What's a good way to do this? ...

How to make "swipe to mark as read" menu like Reeder?

Anybody can tell me how to make "swipe to mark as read" menu like Reeder (img below)? ...

Using sortUsingSelector on an NSMutableArray

I have used sortUsingSelector to sort an NSMutableArray of custom objects. Now I'm trying to sort an NSMutableArray containing NSMutableArrays of custom objects. Can you use sortUsingSelector on an NSMutableArray, or does it only work for custom classes? ...

Linker error when compiling iPhone app for Simulator using OGRE libraries

I'm trying to build an iPhone app using the OGRE framework, and I'm getting a linker error when building for the simulator that I'm not sure how to fix. I created the Xcode project using the OGRE iPhone template. I'm using the static libraries for OGRE from the main website, Ogre_iOS_4.0_Dependencies_20100623, and trying to build for t...

Swapping elements in an NSMutableArray

Are there any special methods to make swapping elements in an NSMutableArray easier or more direct? ...

Using JSON Framework on iPhone - HELP!

Currently I am using the following code to parse the JSON link sent. This is how I also send a GET call to the Google Reader API for an upcoming iPhone application of mine. - (NSArray *)subscriptionList { if(!cookies && [cookies count] == 0) { [self requestSession]; } NSString * url = @"http://www.google.com/reader/api/0/subscripti...

Finding IP address of development machine for Web API + iPhone setup

I'm working on some iPhone apps that communicate with an HTTP-based API server (which happens to be Rails, but that's irrelevant here), and oftentimes I've been bitten by the IP (un)reachability from the iPhone device to my MacBook Pro - the iPhone device must hit the URLs on the MBP. Right now, I have something like this in Config.h: ...

How to get a single NSString character from an NSString

I want to get a character from somewhere inside an NSString. I want the result to be an NSString. This is the code I use to get a single character at index it: [[s substringToIndex:i] substringToIndex:1] Is there a better way to do it? ...

How can I reset cocos2d game state?

I am not entirely sure how to properly phrase this question so I'll explain what happens. I have a cocos2d game, and after I exit the game and start it again, it starts at the exact same point. Its as if it is "saving." Is there any way to prevent this? Thanks ...

QuickLook consumer as a delegate from an NSViewController

I am having some problems implementing QuickLook functionality from a table in an NSView. The limited documentation on QuickLook really doesn't help at all. After reading through the Apple Docs (which are geared heavily towards custom generators and plugins), I ended up looking at the QuickLookDownloader sample code. This code is based ...

iphone: applicationDidFinishLaunching method & iOS 4.0+

I currently have an iPhone application that makes a call to an API to obtain an Access Token. This function is currently executed in my -applicationDidFinishLaunching method in the AppDelegate.m file. However, with iOS4.0 and its ability to multitask, does this method get called each time the app is opened? If not, is there a special...

Storing different data types in a NSArray

I'm trying to store different data types in a NSDictionary to save in NSUserdefaults when the game terminates. I'm trying to store a char, 3 floats and a string, I keep getting a warning on the char and the floats and I cant seem to find the answer anywhere. 1)Do i even need to setup the arrays? 2) How do I store the different data types...

Polymorphism in objective C

I guess there is no operator overloading in objective C. Exact function overloading as in C++ is not present. In what way polymorphism is implemented in objective C? ...

title of navigationController.

Hi i m doing this.. -(id)initWithNibName:(NSString*)arg1 bundle:(NSString *)arg2 { if([super init]) UINavigationController *navController=[[UINavigationController alloc]init]; navController.navigationitem.title=@"Test"; [self.view addSubView:navigationController.view]; } It is showing NavigationController but without any title. I wan...