objective-c

How can I know whether an instance implements a method in Objective-C ?

I would like to know if an instance implements a specific method. I could use respondsToSelector: but it returns YES if the instance inherits the method... I could loop through the methods of class_copyMethodList(), but since I might want to check a lot of instances, I wanted to know if there was a simpler solution (like repondsToSelect...

How can I retain the editing in the tableView of the search result with UISearchDisplayController?

I want to search a table in editing mode, but when I type a letter the variable tableView.editing is changed to NO. And when I cancel the search, the tableView.editing return to YES. I'd like to retain the editing YES in the result of the search. I put breakpoint in several methods. Until the filterContentForSearchText method, the varia...

Help creating custom iPhone Classes

This should be a simple question, but I just can't seem to figure it out. I'm trying to create my own class which will provide a simpler way of playing short sounds using the AudioToolbox framework as provided by Apple. When I import these files into my project and attempt to utilize them, they just don't seem to work. I was hoping some...

UIButton and UIControlEventState issue

I'm having a very specific "bug" in my iPhone application. I'm setting two images for the highlighted and normal states of a button. It works as expected when you "press" and then "touch up" at a slow pace, but if you click/tap it quickly, there's a noticeable flicker between states. Is this a known bug or am I setting the states incorre...

Automatically determining the size of a UITableViewCell

I am trying to determine the size of a UITableCellView. The reason being that I am using one class for different orientations and devices. The cell contains one subview that is supposed to fill the entire cell. Right know I'm doing this in the UITableViewCell's init method: if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ ...

How would you parse the location text from Twitter to get the latitude/longitude in Objective-C?

The location text from Twitter could be just about anything. Sometimes Twitter clients set the location with the user's latitude and longitude in the following format. "\U00dcT: 43.05948,-87.908409" Since there is no built-in support for Regular Expressions in Objective-C I am considering using the NSString functions like rangeOfStrin...

Objective-C:Casting methot to button without using NIB file?

HI.i am trying to use some action when I click button in navigation controller.But I created this navigation controller and navigation item with coding.And I know how cast in NIB button with action but .How can I do this with coding? ...

Checking the time in Objective-c?

how can I get the current time in hh:mm format? I need to be able to tell between AM and PM and compare between the current time and a second time as well. I'm sure it's a silly function but i can't seem to figure it out. ...

Issue Displaying/Hiding Views (Obj-C iPhone Programming)

All right all, So I've got a UITableView that is inited in applicationDidFinishLaunching like so: [self showForumList]; Said method does this: -(void)showForumList { ForumList *fl = [ForumList alloc]; [fl initWithNibName:@"ForumList" bundle:[NSBundle mainBundle]]; self.ForumList = fl; [window addSubview:[self.ForumList ...

objective C NSString retain

If I create a String with [NSString StringWithFormat], do I have to [retain] it? My understanding is that convenience methods add the objects to autorelease pool. If that is the case, shouldn't we retain the object so that it doesn't get drained with pool at the end of the event loop? ...

Best way to define an immutable class in Objective C

Hi, I am a newbie in Objective C and I was wondering what is the best way to define an immutable class in Objective-C (like NSString for example). I want to know what are the basic rules one has to follow to make a class immutable. I think that : setters shouldn't be provided if properties are used, they should be readonly to "disa...

Objective-C with some Objective-C++, calling a normal c++ method "referenced from" problem

Hi, I made an Objective-C project for the iPhone. I had only one cpp class, the soundEngine taken from some Apple demo. Now I'm trying to merge OpenFeint which is coded in Objective-C++. I dropped in the code, by simply dragging the files and just tick "Call C++ default ctors/dtors in Objective-C" in Project Settings. I am not even refer...

How can I call the iPhone to draw using other method?

I have a view with a class called "drawingViewController", and I have the drawRect method: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor); CGContextMoveToPoint(context, 0.0...

How do I call create a name of a button variable in a code, with a number in it?

I've got a int, that is changed in a previous method, that now has to be part of the name of a button variable. For example: int numberFromLastOne; numberFromLastOne = 4; I then want to get 'button4' to do something. Could I use something like this? [[button@"%d", numberFromLastOne] doSomething:withSomethingElse]; I've never had t...

Any ideas on How to get the Google Finance Data from iPhone?

The Google Finance API only have Java / Javascript. Is there any ideas on getting Google Finance data from iPhone using Objective C? thz u. ...

return nil for dateFromString call of NSDateFormatter

I am getting nil returned for the date variable in the below code. I can't find any problem with the date format, can anyone help? NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"EEE MMM dd HH:mm:ss zzz yyyy"]; NSString *dateString = [[NSString alloc] initWithFormat:@"%@", @"Mon Apr 05 04:37:28 U...

Why can't I store a float value - it's always zero!

I have a view controller that is created by the app delegate - it's the first one shown in the app. In its interface I declare float lengthOfTime; I also set it as a property: @property (nonatomic) float lengthOfTime; And in it's implemetation: @synthesize lengthOfTime; In the class viewDidLoad method, I set the value: self.le...

what the procedure of display image in particular UItableview(grouped) cell iphone ?

what the procedure of display image in particular UItableview(grouped) cell iphone ? ...

About updating a View using in iPhone using Objective C.

I have a scene, called testScene, it works like this: @interface testScene : myScene { IBOutlet UIView *subview; IBOutlet UIView *drawingCanvasView; IBOutlet UIButton *update; } - (void)updateDrawingCanvas: (id) sender; and when the user click the button, update, it will run the updateDrawingCanvas method. So, I have a drawingCan...

How do I Call a method from other Class

Hi guys, I'm having some trouble figuring out to call methods that I have in other classes #import "myNewClass.h" #import "MainViewController.h" @implementation MainViewController @synthesize txtUsername; @synthesize txtPassword; @synthesize lblUserMessage; - (IBAction)calculateSecret { NSString *usec = [self calculateSecretForUser...