objective-c

Can I have a UIBarButtonItem with a colored image?

I have an image that I want to display on a UIBarButtonItem, but for some reason it only shows the outline of it and the rest is all white. How can I have it actually display the image? Thanks! ...

Is objc_msgSend() the significant piece that makes Objective-C object oriented?

While reading the documentation, I wonder if objc_msgSend() is actually the "core technology" in delivering the functionality for making Objective-C "object oriented". Maybe someone can explain in more detail which other pieces come into place to enable the object oriented paradigm of Objective-C? ...

How to return correctly a NSMutableString from a method

Hi, I'm looking for a good way to return a string constructed by a NSMutableString avoiding leaking : eg: +(NSString *)myMethod{ NSMutableString *numberToReturn = [[NSMutableString alloc] init]; [numberToReturn appendString:@"lorem ipsum"]; return numberToReturn; } The leak instrument said I had leak with this variable. I t...

How to create a root object in Objective-C without NSObject?

The documentation says: While not strictly a part of the language, the isa pointer is required for an object to work with the Objective-C runtime system. An object needs to be “equivalent” to a struct objc_object (defined in objc/objc.h) in whatever fields the structure defines. However, you rarely, if ever, need to c...

Compare NSString accounting for articles (i.e. "the" and "a")

I thought caseinsensitiveLocalizedCompare: would take care of this (that is not including "the" and "a" in the comparison) , but it does not. (Also, In response to the first answer below, I understand that "case insensitive" part wouldn't help, but I thought that the "localized" part may help. I can't find any options to do this and g...

Properly zooming a UIScrollView that contains many subviews

I created a zoomable UIScrollView and added 100 subviews to it (tiled). The view scrolls perfectly left and right. However, I'd like to allow zooming. To do so I read that my delegate needs to implement: - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return ???; } I have seen examples that have only one subvi...

How to put a date from strftime in a nsstring in obj-c?

i want to be get a date (the current hour) from strftime and get it into a nsstring in obj-c for the iphone-os ...

alloc/init and the setting of instance variables

It is my understanding that, in addition to allocating memory, alloc sets all instance variables (with the exception of the isa variable) to zero or to the equivalent type for zero, such as nil, NULL, and 0.0. But I recently read the following about init: Initialization sets the instance variables of an object to reasonable and ...

MVC and Property Terminology in Objective-C

Hello All, I am having a problem with terminology I think. Is a ViewController the Controller portion of MVC? Or is it not the same thing. Is this combining the VC of MVC into one file? Properties like .backgroundColor and .size are these the same thing as the @property and @synthesize and if so is this the same thing as an attribute...

Cocoa question for displaying images

I was wondering if anyone could tell me if there is a method in Cocoa that will display information (images) on screen when a button is pressed. What I mean is NSLog "prints text" to the console is there a method that displays images just as easily like would -(void)drawView do it? Is it just setNeedsDisplay? I hope this makes sense. I a...

Getting Objective-C Objects in PHP

Hi all, I am sending an NSData Object to the server script running PHP.Is it possible to collect that object in PHP ? Is it possible to get NSArray,NSString, NSData or any Custom Objects (Subclass of NSObject) in PHP ? Thanks ...

My value in UITableview is repeated after 11th row in objective-c.

I an getting same value in my tableview after the 11 row. after the 11th row again the name of row start as first row. ...

Compare dates using cocoa objective c

Is it necessary that i have to write the following method to call it in the if....part. -(NSComparisonResult) compare:(NSDate *)expDate{} if yes, then how and where i have to write this method so that the following code will work fine? if (licenseDictionary == nil) return @"Not Registered"; else if([today compare:expDate] == NSOr...

How to change background color of the textfield in iphone?

I want to change the background color of the textfield to something which is transparent. I have tried option5btn.backgroundColor = [UIColor grayColor]; But I want some other color. Can anyone tell me which all colors can be used in the iphone textfield's background. Can anyone help me with this. ...

query select Sqlite Objective C iphone

hi people! well, I have problems with my queries,i dont know why!! please help i try to select an id from a table named moneda and I give the name like parameter, this is my method with my query : -(int)ConsultaIdMoneda:(NSString*) nombreMonedaParametro { int idMonedaObtenido; NSLog(@" entre a consultar id de la moneda desde...

value in the Table view is repeating after the 11th row.

I am beginner iphone developer I want created table in programatically. In the table we take more than 20 row. But i have some problem that after 11th row the same value repeated. plz help me with code and other method ...

Objective-C + release Objects

I am using the following function in my application: +(TeamTournamentLookUp *)getOpponentTeamTournamentLookUp:(int)tournamentId:(int)opponentTeamId { TeamTournamentLookUp *objOpponentTTL = nil; const char *sql = "SELECT TeamTournamentLookUpID, TournamentID, TeamID, NumberOfWins, NumberOfLosses, NumberOfDraws, Points, Rank, IsUs...

msgStore was not declared in this scope (XCode)

I'm implementing callback routines for external static C++ library to be used in Objective-C project. Now I have trouble moving data between callback and normal routines. As you can see below my "msgStore" is defined as part of MyMessage class and can be used within class routines such as init(). However attempting same from callback rou...

Comparison of text color in UILabel with UIColor fails

I'm trying to compare the text colour in a UIlabel with a UIColor but the result is always false. The following code produces the result: color equal 1, 0 I expect both a and b to be equal to 1. Is there another way to do this compare? bool a,b; UIColor *myColor1, *myColor2; myColor1 = [UIColor redColor]; mainViewController.ti...

TextField in UITableView

I m new to iphone world .. help me out of this. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *MYIdentifier =@"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MYIdentifier]; if(cell==nil) { cell=[[[UITableViewCell alloc] initWith...