objective-c

How to change the background of a toolbar

How do I change the toolbar's background? ...

UILabel ghosting when printing NSInteger with transparent background

I have a UILabel in a UITableCell, and when I make the label's background transparent, I get these strange ghost characters (see image below), and it looks terrible. Here's my code: Left: UILabel *unreadLabel = [[UILabel alloc] initWithFrame:CGRectMake(270, 7, 25, 25)]; unreadLabel.text = [NSString stringWithFormat:@"%d", source.unread...

Am I using Objective-C collections properly here?

I'm attempting to write an iPhone game. This function is intended to apply gravitational force to several objects. I'm porting it from Python and I'm wondering if my use of dictionaries and arrays as tuples makes sense and is typical/idiomatic in Objective C. Any comments on the code appreciated. + (void)updateBodies:(NSMutableArray*...

How can I convert the characters in an NSString object to UILabel objects?

Hello. I'm trying to figure out how to take the individual characters in an NSString object and create UILabels from them, with the UILabel text set to the individual character. I'm new to Cocoa, but so far I have this... NSString *myString = @"This is a string object"; for(int i = 0; i < [myString length]; i++) { //Store the cha...

How to change the tableviewcell 's backgroundimage?

when I selected row, change the backgroundimages? ...

[NSUserDefaults standardUserDefaults] Change Doesn't Persist

I've been working with the Dropbox API as of late, and have run into an infuriating but interesting snag. The SDK saves OAuth tokens in standardUserDefaults, and if the user wants to disable the Dropbox functionality the OAuth tokens have to be removed (otherwise the SDK finds them and goes off to work). Here's the weird part: whether I...

Anyway to quickly break a word into an array of characters in objective c?

For example: NSString *strWord = "english"; The result NSArray would be something like: e n g l i s h I think is possible to do it with [NSString componentSeparatedByCharacter:somecharacter], but I don't know what that character is... I wrote something like this to extract the character: NSString *character; for (int i=0; i<[strWor...

MKAnnotation problems

I don't think I am understanding this correctly, I added the annotation to the map. I can see it, the color is red. However, I want to change it to purple and I want it as a button. So I put it as follows: // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewD...

Which technique to use for creating private methods in Obj-C ?

When I want to create private methods in Objective-C, what should I use? 1) The well known categories technique. 2) @private directive. (I'm doing iOS development). ...

Memory management semantics of Objective C "new"

Is "new" an equivalent of "alloc init" or "alloc init autorelease"? I cannot seem to find it in any tutorial or article that deals with Cocoa memory management. Thanks for advise. ...

Is it possible to define ivars in Objective-C extension?

I wonder if it is possible to write something like this in the .m file: @interface MyController () {//ERROR here Foo *privateFoo; } @end I did it but I get : Expected identifier or '{' before '{' token, I think I heard/watch a video (WWDC2010) saying this is possible or will be possible and currently only some architectures suppo...

How to upload a file from the front end (view) in an iphone app?

Hi, In my iphone app, It is a requirement that I enable the user to upload the database file (.sql) from the front end of the app or through iTunes and the app should display the data based on the file he/she uploaded. How should I go ahead with implementation? Please give your suggestions. Please Help. Thanks!! ...

Making a password lock for an app?

Hello there! I'm wanting to make a password unlock screen for my app, and I'm not sure how I'd go about it. I'm wanting it to look like the Apple-designed version of it, which is the passcode lock setting screen. How might I go about doing something like this, where as soon as all four digits are entered the code is immediately chec...

NSThread detachNewThreadSelector???? uh?

Hi, I was looking through the Threading Programming which I have to say it's really good. Specially I was looking on How to configure Port-based input sources for running loops. And I see this piece of code // Detach the thread. Let the worker release the port. [NSThread detachNewThreadSelector:@selector(LaunchThreadWithPort:) ...

Reading samples via AVAssetReader

How do you read samples via AVAssetReader? I've found examples of duplicating or mixing using AVAssetReader, but those loops are always controlled by the AVAssetWriter loop. Is it possible just to create an AVAssetReader and read through it, getting each sample? Thanks. ...

CGImageRef Leak.

Maybe this a newbie question, but according to my instruments there is a leak there, but im releasing the imageRef. i cant figure it out. its a category function. -(UIImage *)imageAtRect:(CGRect)rect { CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], rect); UIImage* subImage = [UIImage imageWithCGImage: imageRef]; CG...

check if a zip file has password-protection, in objective-c

I have used ZipArchive library to zip and unzip files, but it doesn't give a clue about how to check if the zip file is password-protected. I need to be able to check whether a .zip file is password-protected. If it is, I will prompt the user for a password; otherwise just unzip it. Anyone have an idea of how to check this? Is there an...

What should be in a NavigationController

I have a table view which is inside a navigation controller, however besides this the navigation controller does nothing else. So the class is pretty useless. I also have a navigation controller, which has a mapviewcontroller inside, other than that.. it has nothing else. I know the job is important, that it navigates views back and fo...

How to selected the first row on the tableview ,default

How to selected the first row on the tableview ,default ...

[Objective-C "Bindings"] How to refresh an NSTableVIew when you populate the NSMutableArray (bind) associated with it .

Hello there I just want to ask that I tried to bind my NSArraycontroller to an NSMutableArray, the array holds objects of type "iData" (its a custom class). The class further contains some NSMutableString variables, the variables are set as keys for KVC. Further i bind the my NSTableColumn to the NSArrayController and set key model paths...