Converting NSData to NSString in Objective c
Use below code. NSString* myString; myString = [[NSString alloc] initWithData:nsdata encoding:NSASCIIStringEncoding];
Use below code. NSString* myString; myString = [[NSString alloc] initWithData:nsdata encoding:NSASCIIStringEncoding];
I would like to also emphasize that the reason you cannot do this is a business decision that Apple made, not a technical decision. To wit, there was no rational technical justification for Apple to disable sound from web apps on the iPod Touch. That is a WiFi device only, not a phone that may … Read more
I loved ASIHTTPRequest and I was sad to see it go. However, the developer of ASI was right, ASIHTTPRequest has become so large and bloated that even he couldn’t devote time to bring it to par with newest features of iOS and other frameworks. I moved on and now use AFNetworking. That said, I must … Read more
Assume you have a UIView scene with a background image and many vehicles, you may define each new vehicle as a UIButton (UIImageView will probably work too): UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button addTarget:self action:@selector(imageTouch:withEvent:) forControlEvents:UIControlEventTouchDown]; [button addTarget:self action:@selector(imageMoved:withEvent:) forControlEvents:UIControlEventTouchDragInside]; [button setImage:[UIImage imageNamed:@”vehicle.png”] forState:UIControlStateNormal]; [self.view addSubview:button]; Then you may move the vehicle wherever you want, … Read more
The previous answer is correct, but if the effect you are looking for is to redirect HTTP traffic for a domain to another IP there is a way. Since it technically is not answering your question, I have asked and answered the question here: How can I redirect HTTP requests made from an iPad?
In IOS6 you have supported interface orientations in three places: The .plist (or Target Summary Screen) Your UIApplicationDelegate The UIViewController that is being displayed If you are getting this error it is most likely because the view you are loading in your UIPopover only supports portrait mode. This can be caused by Game Center, iAd, … Read more
I found that “:hover” is unpredictable in iPhone/iPad Safari. Sometimes tap on element make that element “:hover”, while sometimes it drifts to other elements. For the time being, I just have a “no-touch” class at body. <body class=”yui3-skin-sam no-touch”> … </body> And have all CSS rules with “:hover” below “.no-touch”: .no-touch my:hover{ color: red; } … Read more
Jeremy Keith (@adactio) has a good solution for this on his blog Orientation and scale Keep the Markup scalable by not setting a maximum-scale in markup. <meta name=”viewport” content=”width=device-width, initial-scale=1″> Then disable scalability with javascript on load until gesturestart when you allow scalability again with this script: if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) { var viewportmeta = … Read more
You could set a transparent color to the -webkit-tap-highlight-color property of that element. a { -webkit-tap-highlight-color: transparent; }
You can add a UITapGestureRecognizer instance to your UILabel. For example: UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelTapped)]; tapGestureRecognizer.numberOfTapsRequired = 1; [myLabel addGestureRecognizer:tapGestureRecognizer]; myLabel.userInteractionEnabled = YES;