objective-c

Rounding a float to 1/4ths in Objective C

what's the most elegant way of rounding a float to it's closest 1/4ths in Objective C? For example: 3.14 should be 3.25 2.72 should be 2.75 6.62 should be 6.50 1.99 should be 2.00 etc. ...

Secure online-game http get/post request (How to avoid repeated sending of the same http-req)

In my game/app (iPhone) the client side sends http requests (get or post) to the game http server. Requests have this form: gameserver.com/userId/givebonus/100 This for example would give the userId a bonus of 100. Now, we encrypt the server request and it will become something like: gameserver.com/42c34c234c234/ghjghjg4hj32g42jh2/42...

Reinitializing iPhone app when it relaunches

I am building an iPhone app. Currently when I close the app and relaunch it, it relaunches on the last viewed view. Instead I want to be able to reinitialize the app, and present the view that's most appropriate for the application's state (based on what's in the database). How can I do that? ...

How to archive an NSArray of custom objects to file in Objective-C

Hello, Can you show me the syntax or any sample programs to archive an NSArray of custom objects in Objective-C? ...

Iphone QTVR (QuickTime Virtual Reality) support

I'm planning to write iPhone app which have to be able to play QTVR (QuickTime Virtual Reality) movies (it'll be one of its core features). I know there are couple of apps capable of doing it, thus I'm wondering if there is any library available that supports playing such content? ...

Problem with numberOfRowsInSection and dictionaries

Hi All, I have created a dictionary with a number of different bits of information all pulled from and xml feed. I now want to pull certain parts from the dictionary into areas to create my tableview. so far creating the section headers was fine, but having a problem with the numberofrowsinsection part: - (NSInteger)tableView:(UITable...

An app used SMS functionality, how to publish the app to disallow ipod touch user download.

I used some code like below: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://123"]]; what would happen if it runs in ipod touch how to target iphone user only when publish the app to the store. ...

How to achieve smooth animation when using single-step rotation / How do I get the new frame size at the start of rotation?

Hi all, I'm trying to switch from two-stage rotation to one-stage rotation (to avoid the console warning, and because Apple recommend doing so because one-stage is faster). However I can't figure out how to get the new size of my view (taking into account the navigation bar, status bar, etc) early enough to perform the update of my UI ...

Getting the scale factor from a CABasicAnimation

Hi there, I'm animating a shrinking object. At any point the user can hit a button to get the current scale factor of the object. (I start by scaling the object up using a CGAffineTransformMakeScale, so the scale factor should be 1 when it reaches its original size). I'm just not sure how to retrieve the current scale factor from the ani...

access plist data

Hi, i have a plist which goes like this: <dict> <key>11231654</key> <array> <string>hello</string> <string>goodbye</string> </array> <key>78978976</key> <array> <string>ok</string> <string>cancel</string> </array> i've load the plist using this: NSString *path = [[NSBundle mainBundle] pa...

In Objective-C on iOS, what is the (style) difference between "self.foo" and "foo" when using synthesized getters?

I have searched many questions on ObjC accessors and synthesized accessors to no avail. This question is more of a "help me settle an issue" question; I don't expect one answer, but I'm rather looking for experts to weigh in on the argument. In a Cocoa Touch class, I would write some code like this (where soundEffects is a synthesized ...

remove UIView subview based on tag?

I am creating a view like this: UILabel *qty = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 20)]; qty.backgroundColor = [UIColor whiteColor]; qty.text =[NSString stringWithFormat:@" Qty: %@", currentQty]; qty.alpha = 0.5; [qty setTag:999]; [self.view addSubview:qty]; [qty release]; This can happen multiple times in this view c...

How do I hide the tabBar on the first loading, and show on later screens?

.hidesBottomBarWhenPushed = NO; doesn't work because the view isn't getting pushed. I want the tabBar to be hidden on the first screen and able to show it again a few screens later. How can I do this? ...

What files are generated by Xcode when compiling and linking?

Since I'm used to developing in Java, I'm familiar with what files get generated by the build process and can tell what files to exclude from SVN and HG when I do comits. I'm just starting out learning some iOS app building using XCode. With XCode and Objective-C on a Mac, I don't know what files get generated. If there are files sp...

OS X Keychains: 32 to 64 bit

I recently switched my application from 32 bit to 64 bit on Mac OS X. The only problem that I am having now is some users are complaining that their existing keychains are not being saved anymore and they cannot create new ones. Is there any reason the keychain service would stop working after such a switch? The actual code to process th...

Is it okay to call an init method in self, in an init method?

Recently I realized I needed to add an argument to the init method for a helper class I've got. The helper class deals with alert views so it already has a bunch of arguments in the init, which are looked at, tweaked, and then sent on to the alert view. Since I'm using the method as it is in various places, I don't want to risk crashin...

Add a second image to a custom UIButton

I've got an Custom UIButton. It's got a "static" background image a variable text (the Title) which gets set in the code Now I would like to add an icon (UIImage/UIImageView) inside the button on the left of the text. (I use the indent to move the text slightly to the right). Is there an easy way of adding that icon (and referencin...

Image from UIView

Hi, is there any Possibility to create a image out of a UIView? Thanks, Andreas ...

iphone : xcodebuild command from terminal not working, How to ?

Hi, i am running xcodebuild command from terminal but getting the following error ATION (Release) === Check dependencies error: There is no SDK with the name or path 'iphonesimulator3.1.3' [BEROR]error: There is no SDK with the name or path 'iphonesimulator3.1.3' ** BUILD FAILED ** what is the possible reason i m getting this error ?...

How to calculate focusPointOfInterest for AVCaptureDevice?

How do you calculate the focusPointOfInterest (a CGPoint value between 0,0 and 1,1) for an given AVCaptureDevice? I've been following the code samples from the latest WWDC but I really don't understand how to calculation is being made. Also, my application is sitting in landscape vs. portrait (as in the sample) ... so in addition to no...