objective-c

getting json_encode to not escape html entities

I send json_encoded data from my PHP server to iPhone app. Strings containing html entities, like '&' are escaped by json_encode and sent as &. I am looking to do one of two things: make json_encode not escape html entities. Doc says 'normal' mode shouldn't escape it but it doesn't work for me. Any ideas? make the iPhone app un-es...

Why are my properties `out of scope`?

I have a method to generate some strings based on the values of some variables I get from I picker controller that is presented modally. I get the values back in the delegate method fine and I can assign them to some properties in my view controller successfully. When I call my method to do the updating, I send the values to the consol...

custom class = custom +alloc , custom +init

hi guys, I'm new with objective c for the iphone. I'm writing a custom class, then, should I write my own +alloc, +init methods? I believe that: the +alloc will just call [thing alloc]; and the +init will perform something like: [thing setValue:X]; is there a "default" +alloc and +init methods? if yes, what should I wait for the defaul...

object_setClass to bigger class

I am changing the class of some objects using object_setClass(id object, Class cls). I am changing the class to a subclass of the original class. Then I set some properties that are only defined on the subclass, and things seem to work fine. I was a bit surprised that this worked, because object_setClass, as far as I understand, doesn't...

How to search and correct html tags and attributes?

In my application, I have to fix all the closing tags of the <img> tag as shown below. Instead of closing the <img> with a >, it should close with />. Is there any easy way to search for all the <img> in this text and fix the > ? (If it is closed with a /> already then there is no action required). Other question, if there is no "widt...

Did OS4 change how the iPhone reads code?

The code I wrote for 3.2 performs differently in OS4. Still no errors, just new bugs. So I'm initializing the imageView inside an IBAction called "randomize" that produces and random number that goes to one of 86 cases producing a resulting animation and image, the only difference in code between 0 and 86 is that final imageView.image ...

__IPHONE_OS_VERSION_MIN_REQUIRED please explain

I'm developing an app that I would like to deploy for iPhone 3.0, iPhone 4.0 and that can run on the iPad in emulate mode. I'm developing with XCode 3.2.3 and I have videos to playback. I would like to use MPMoviePlayerViewController for >= 3.2 and MPMoviePlayerController for < 3.2. If I use Class mplayerControllerClass = NSClassFrom...

cant find command line utility in x code to start objective c program?

cant find command line utility in x code to start objective c program? how can i start command line utility? ...

Problem using stringByReplacingOccurancesOfString in Objective-C

Hi, I'm having some problems working with NSStrings in Objective C... the code below returns a warning, saying: "'NSString' may not respond to '-stringByReplacingOccurancesOfString:withString:" NSString* NewWord = [Word stringByReplacingOccurancesOfString:@"!" withString:@""]; What ...

How can I center my image in horizontal orientation?

I have an image view that is inside of a UIScrollView so that I can pinch & zoom. My image looks fine in portrait mode, but when I go to horizontal orientation the image is not centered. The UIScrollView is 320x460. Here is my code: - (void)viewDidLoad { [super viewDidLoad]; CGRect frame = CGRectMake(0, 0, 320, 460); self...

Iphone - Class property causes crash

Hi, So I'm still very new to this whole objective C think and I ran into a problem I'm not sure the root cause for. My h file looks basically like this : @interface DrinkDetailViewController : UIViewController<UITextFieldDelegate> { UITextField* nameTextField; UITextField* activeView; } @property (nonatomic,retain) IBOutlet UI...

Set UITextView in focus

I have a UITextView that is editable on a parent view along with a few other things. How can I set the UITextView to focus when the parent view shows up? ...

Cache a webpage on the iPhone with UIWebView

How can I load a web page when internet is available and cache it for offline use and it updates to the latest version when internet becomes available again? ...

Buggy navigation controllers, porting iPhone app to the iPad

I have a fairly simple iPhone application that I want to have run on both the iPhone and the iPad. I'd like to just have the iPad version be a bigger version of the iPhone version, scaled up or not -- I'm working on an iPad-specific version of the app that makes better use of the interface, but wanted to make sure my existing customers h...

Mac OS X api for socks4a

Is there a way to setup a network connection that uses a socks4a in any of the Mac OS X api's or maybe even an external library that I can use? I found that NSStream can use a socks4 or socks5 proxy but there was nothing about socks4a in the documentation that I could find. ...

Seeking advice for iPhone app structure

Hi, I've been tasked with creating an iPhone app which will tap into a series of REST API JSON feeds from Twitter. I'm somewhat new to iPhone development, but I've created a few apps before, though none of them required tapping into API data. So let's say we have 3 views in Interface Builder that are being controlled by a tabcontrolle...

NSView -scaleUnitSquareToSize leaves view blank until it's resized despite -setNeedsDisplay message

I used this guide: http://developer.apple.com/mac/library/qa/qa2004/qa1346.html to implement scaling in a special view. The scaled view is the document view of an NSScrollView. The problem is that when I call -scaleUnitSquareToSize, then call -setNeedsDisplay:YES (I also tried -setNeedsDisplay:YES on the scroll view), the view (not the...

viewWillAppear question

-(void)viewWillAppear:(BOOL)animated{ //something here [super viewWillAppear]; } my question is is this line [super viewWillAppear]; always required? if not when and why do you use it? ...

who released my object on the handler file?

Hi guys, I'm a newbie on the iphone development world.. I started a new project, I used it to test what I learned about objective c, it basically sends and recives data from my local server, then, I store some of that data inside the class, it works fine. Everything is on the command line. my class definition: @interface MyClient : N...

Binding a selector to the target of a NSButtonCell

I'm using the following code to add a target binding to a NSButtonCell control: [dataCell bind:@"target" toObject:eventDatesArray withKeyPath:@"selection.self" options:[NSDictionary dictionaryWithObjectsAndKeys:@"sellTicket:", NSSelectorNameBindingOption, nil]]; eventD...