objective-c

How to start an app with an activated keyboard and a courser in a UITextView?

Hello, I want that my app starts with the keyboard and a courser in my UITextView, so that the user can instantly start to write. How can I do that? Thanks for your help! ...

Difference between variable positions in a header file

Hello What is the difference between me declaring something within the @Interface section of a header file and outside of the { }? I want to be able to get to my properties in my interface at all times, i.e. in an IBAction method so do I always need to use synthesize in the implementation file? Cheers Paul ...

Cocoa setAnimationDidStopSelector

Hi, Currently I have this code that works fine [UIView setAnimationDidStopSelector:@selector(animationDone:finished:context:)]; - (void)animationDone:(NSString *)animationID finished:(BOOL)finished context:(void *)context { // do stuff here } Logging the value of animationID gives me a null. How can I pass value to the @selector? ...

how to create navigation controller push effect using core animation?

I Am creating an application and i want to achieve push effect but without using navigation controller.Does someone knows a core animation source code to achieve this? I have a view hierarchy like this.A main controller which has an header image with 4 buttons on it.I mean it will be displayed all the time whatever view in front of scree...

Cocoa animationImages finish detection

Hi, I'm doing an animation using animationImages and animationRepeatCount = 1; How can I detect when the animation is done? Thanks, Tee ...

How to show an actionsheet when the username/password isn´t correct for Twitter?

Hello, I want that my app shows an actionsheet when the user presses on the "Tweet"-Button and the username or password is wrong. For my Twitterfunction I use the TwitterRequest.m/h from Brandon Trebitowski. If everthing works great and the username/password is right, this happens in my app: TwitterRequest * t = [[TwitterRequest...

Messaging NSArray problem

I am trying to get JSON data loaded from a NSURLConnection delegate to send the array of objects back to the tableview that called it. The delegate object is initialized with callback to send back to NSArray *returnArray; ResultsTableRoot *callback; JSON handling method - (void)connectionDidFinishLoading:(NSURLConnection *)con...

What does this condition test?

Came across this conditional in some uncommented Objective-C code: if (w & (w - 1)) { i = 1; while (i < w) { i *= 2; } w = i; } Where w is a size_t greater than 1. Update: Added the code contained by the conditional for context. ...

How to edit a contact?

Is there any way to edit a contact programmatically in the iPhone? For example, I want to modify a contact which is returned by ABPeoplePickerNavigationController. How can I do this? I have: (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { ...

How to save an image as Tiff or PNG with an alpha channel or alpha mask in iPhone SDK?

I have an image with something inside in a white backround. I want to save that image in a format that allows alpha channel or using an alpha mask in a way that the white pixels became transparents. Any light out there? ...

Objective C protocol as an equal to Java Interface?

Hi The question is not only regarding the headline, but more of a "how will I achieve this, without trying to force a Java/Flash design into an Objective C (iPhone)program". I have 6 views that extends UIView, these views all have different behavior but share certain methods, like -(void) update and -(void) changeState:(NSInteger)state...

Synthesizing an accessor for a member of a struct

Let's say my object has a CGRect property named rect. I want to maintain a single CGRect rather than individual CGSize and CGPoint (for comparison against other CGRects with CGRectContainsRect()) but I want accessors for the individual members so I don't have to recreate a whole new CGRect every time I want to change one or the other. ...

Enumerations in Objective-C

I'm making the jump from Java to Objective-C. I'm wondering if there is a concept analogous to Java's enums, that supports implementations of methods. I realize Objective-C has plain old C enumerations, but those are really just ints. I'm looking to prevent switch-yards -- Java enums would be perfect. ...

Copy & mutableCopy?

What is the difference between the "copy" & "mutableCopy"? EDIT_001: My original post was a bit of a mess, partly due to a lack of understanding and partly due to a bit of pilot error on my part. Here is my attempt to better explain how "copy" & "mutableCopy" work. // ** NSArray ** NSArray *myArray_imu = [NSArray arrayWithObjects:@...

NSScrollView doesn't display vertical scrollbar after adding content

I've created an NSScrollView which itself contains a NSClippedView as content view (this is all default, created by IB). Inside the contents view there is the (default) document view. This NSScrollView has horizontal scroller disabled and vertical enabled and, most importantly auto hide scrollers enabled. When I add new views (via code...

program not displaying simple side values for my triangle object properly in nslog

Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on the book "programming in Objective c 2.0" and working on exercise 8.5, where you have to build a bunch of classes and subclass a homemade abstract class into a square class a triangle class and a circle class. you also have to calculate the a...

How can I get the app store link to upgrade my app (iphone)?

I'm trying to prompt the user (once, I record it) to upgrade the iphone app if it is out of date. I've found a few sites that explain how to get the link to your app in the app store once it is already there. Here's one for example (http://bit.ly/6QIC40). The problem is, all these guides require the app to be in the store before you c...

What's special about a const @"SomeString"?

Example: FOUNDATION_EXPORT NSString * const NSLocalNotificationCenterType; What is changed through that type qualifier? I understood it, if const was in front of the asterisk. ...

[Cocoa OSX] Can't detect color of a pixel in a pixel that... changes color

Hello, I am trying to create an application that when the color of a pixel on screen changes to another one (that I know what it is) it does something, doesn't really matter to the question what it does. Anyway, I am using this: CGImageRef window283x420 = CGWindowListCreateImage(NSMakeRect(284, 420, 1, 1), kCGWindowListOptionOnScreen...

can you return two arguments in objective-c?

Just wondering if you can return two arguments in an objective c method, for example I'd like to return a cartesian coordinate (x,y), basically two ints. is the only way to do this by creating a class and returning an instance? Is there some other way I'm not thinking of, kind of a beginner here. any syntactical help would also be appre...