objective-c

UIDatePicker UIDatePickerModeCountDownTimer mode can't select zero minutes

I'm using a UIDatePicker in UIDatePickerModeCountDownTimer mode which lets the user select hours and minutes, but it won't let the user select zero hours and zero minutes. If the hours are set to zero and the user tries to pick zero minutes, it automatically jumps to 01. I've researched the docs and nothing seems to allow me to do that,...

Retrieve country name from iPhone gps without internet!

Hello, In my application on the iPhone and iPod Touch I want to be able to retrieve the country a person is in without accessing the internet. I know how to do this with internet, so I know how to retrieve the longitudes and latitudes, I've read something about a file with the world borders included, but I don't know how to use this in ...

Superglobals in Objective-C and iOS

Hey! I'm trying to add some sort of a superglobal in my app. It will only store a small integer, but I need it to be accessible from anywhere in my app. I know you can use the delegate for this, but wouldn't it be easier if you could just set a superglobal in your application (of course it has to be alterable)? So, what is the best wa...

Creating UIView with layer from Application Delegate

Starting off with a default "View based" application I create a new view (ViewToDisplay, class that inherits from UIView) and inside this view I create a layer (LayerToDisplay). The view draws something around the perimeter of the frame, and so does the layer but this time with dotted lines. This is to show / prove that the layer covers ...

Objective-c access struct variable from an array of structs

I have a struct called Point typedef struct { GLfloat x; GLfloat y; } Point; create an array of Points: Point *sPoints; for(int i=0 ... // define sPoints somewhere else, I want to alter variables on those points. Why does this work: sPoints[100].x+=10; but this doesn't: Point pt = sPoints[100]; pt.x +=10; is there any way...

Quicker if-statement: if `variable` is "value" or "value"

Hey! How can you compare against multiple possibilities in one argument? Example: if ((integer == 2) || (integer == 5)) if ((string == "hello") || (string == "dolly)) Would save me a lot of code if you could write that like this: if (integer == (2 || 5)) if (string == ("hello" || "dolly")) ...

Graph API and iOS

How can I use/implement the new Graph API from facebook in iOS programming (objective C)? Also parsing the JSON file returned by the API? I can't seem to find any examples out there. Facebook resources doesn't give too many details on iOS development. ...

Accessing iPhone's current location

How can I store the latitude and longitude coordinates of the iPhone's current location into two different float variables? ...

Is it possible to cover UIStatusBar with a view while maintaining scrollsToTop functionality?

I want to display a message to the users of my app in the UIStatusBar, but I'd like to maintain the scrollsToTop functionality so a user can tap on the statusbar and scroll a tableView up to the top. I've looked into adding a UIWindow on top of the current status bar as in this question: http://stackoverflow.com/questions/2666792/add-u...

how to darken a UIImageView

I need to darken a UIImageView when it gets touched, almost exactly like icons on the springboard (home screen). Should I be added UIView with a 0.5 alpha and black background. This seems clumsy. Should I be using Layers or something (CALayers). ...

Resize NSArray Programmatically

Hello, I have been trying to figure out if it is possible to programmatically resize an NSArray, by code similar to this: NSArray *resize = [NSArray arrayResized:oldarray size:10]; Which would a new NSArray (Not a NSMutableArray if it is possible) that has the elments after the end of oldarray padded with [NSNull null]. ...

Google API for objective-c app

is there a way to get emails from google, send emails, and add contacts to the address book using the google API? I'm doing an obj-c mac application. ...

Blocks instead of performSelector:withObject:afterDelay:

I often want to execute some code a few microseconds in the future. Right now, I solve it like this: - (void)someMethod { // some code } And this: [self performSelector:@selector(someMethod) withObject:nil afterDelay:0.1]; It works, but I have to create a new method every time. Is it possible to use blocks instead of this? Basi...

How can i make visual keyboard appear above my UIToolBar?

I have a UITextView at the midle of View, UIToolBar at the bottom of View. I want visual keyboard appear above UIToolBar when i touch on UITextView. How can i do it? ...

unique values of custom object NSString property in nsarray

I have an array which stores custom objects. Objects are of type Venue which have a property defined as name(which contains the names of venue). Now I want to filter out objects with unique names. This is how I was trying to do. NSSet *uniqueVenuesSet = [NSSet setWithArray:[venueArray valueForKey:@"name"]]; NSMutableArray *uniqueVe...

Order Integers In Ascending and Descending Orders

I'm working with Objective-C, but probably it doesn't matter the programming language for this. So basically I have an array, with say, the integers 12, 5, and 17, and I want to be able to pull out the largest number, or the smallest, or second smallest, etc. Basically I want to be able to sort them into ascending or decending order so...

How do I dynamically add images to a UIScrollView?

I'm working on an an app that updates both a UITableView and a UIScrollView. I like how UITableView updating works. As I add, remove, or update items, I call insertRowsAtIndexPaths:withRowAnimation:, reloadRowsAtIndexPaths:withRowAnimation:, and deleteRowsAtIndexPaths:withRowAnimation: as appropriate. However, updating the UIScrollView h...

removing duplicates from array in objective c

I have an array with custom objects. Each array item has a field named "name". Now I want to remove duplicate entries based on this name value. How should I go about achieving this. Thanks in advance. ...

Using variables in methods in objective c

Is there any way define a object in a method, call a method of another object, and in that method use the first object: -(IBAction)method{ class * instance = [[class alloc] initWithValue:value]; [instance method]; } The method defined in class.m file: -(void) method { instance.value = someOtherValue; } ...

Need help handling error message: Ivalue required as left operand of assignment

When I try to compile my code where ann is an annotation, coordinate is a 2d coordinate, and latit is a float ann.coordinate.latitude = latit; I get an error message saying Ivalue required as left operand of assignment. What does this error mean and why is it showing up? ...