iphone-sdk-3.0

UIApplication openUrl not working with formatted NSString

做~自己de王妃 提交于 2019-12-03 05:53:20
I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@, Anchorage, AK",addressString]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]]; But it doesn't work and there is no error. It just doesn't open. URLWithString requires a percent-escaped string. Your sample url contains spaces which results in a nil NSURL being created. Additionally, the addressString may also contain characters that need to be escaped. Try percent-escaping the url string first: NSString *urlString = [NSString

NSHomeDirectory returns different path each time iPhone App is restarted

ぃ、小莉子 提交于 2019-12-03 05:17:47
I noticed that NSHomeDirectory returns a different path each time i restart the App with Xcode, and apparently even if i click the icon manually since it doesn't load the file's contents. I'm stunned that it gives me a different directory each time i restart the app. This happens on both simulator and device and even if i use the "ForUser" method. My calls look like this: NSString* fullPath = [NSHomeDirectory() stringByAppendingPathComponent:@"test.file"]; or NSString* fullPath = [NSHomeDirectoryForUser(@"MrX") stringByAppendingPathComponent:@"test.file"]; or even NSString *docsDirectory =

JSON IPHONE: How to send a JSON request and pull the data from a server?

拈花ヽ惹草 提交于 2019-12-03 04:38:47
问题 I know barely nothing about JSON and I need to send a request to a server and read the data coming from it, using the iPhone only. I have tried to use the jason-framework to do that, but after readin the documentations I was not able to figure out how to construct the object and send it on the request. So I decided to adapted another code I saw here on SO. The Object I need is this: { "code" : xxx } Here I have a problem. This xxx is a NSData, so I suspect that I have to convert this data to

Top margin on UITableViewController

倾然丶 夕夏残阳落幕 提交于 2019-12-03 04:06:46
问题 I have a TabBarController, one of the tabs of which contains a sub view which is a navigationController. I am then loading into the navigation controller a view which inherits form UITableViewController. My problem is thta for some reason the table view starts behing the navigation controller, not the top of the screen but about half way down the navigation bar, hence the top of the first cell in the table view is cut off. Can anyone suggest how to move the UITableViewController down? 回答1:

UITableView page size when paging enabled

一曲冷凌霜 提交于 2019-12-03 03:54:52
问题 I'm facing with a simple but tedious problem. What I'm trying to do is make an UITableView to page like an UIScrollView but enabling paging doesn't help me so much because I can't set page size so the tableview scrolls exactly of its height so it shows rows 1...10 or 11...20 and so on. What I'd like instead is that no cell remains clipped above or under the view when I scroll (thus paging) without having a sort of fixed range of shown cells. Thanks a lot 回答1: More simple and more efficient :)

why does MPMovieLoadState have state 5?

☆樱花仙子☆ 提交于 2019-12-03 02:48:04
I find MPMoviePlayerController.h,there is enum { MPMovieLoadStateUnknown = 0, MPMovieLoadStatePlayable = 1 << 0, MPMovieLoadStatePlaythroughOK = 1 << 1, // Playback will be automatically started in this state when shouldAutoplay is YES MPMovieLoadStateStalled = 1 << 2, // Playback will be automatically paused in this state, if started }; typedef NSInteger MPMovieLoadState; but when i did NSLog(@"%d",player.loadState) it prints out 5 or sometimes 3,how did it happen?As i know the loadstate has value of 0,1,2,4 refer to developer documentation. Thank you! The playState is a bitmask. Any number

Core Text examples for iPhone/iPad

孤街醉人 提交于 2019-12-03 02:29:33
问题 I am looking for a Core Text example for iphone/ipad but with little luck. Any leads would be appreciated. 回答1: I have written a small project on Github that provides an Objective-C wrapper for Core Text: https://github.com/akosma/CoreTextWrapper In particular, it takes any string and renders it over multiple pages, with multiple columns each page. Hope it helps! 回答2: You can find an example of column layout tweaked to work with iPhone/iPad here: http://foobarpig.com/iphone/coretext-example

JSON to Persistent Data Store (CoreData, etc.)

孤者浪人 提交于 2019-12-03 01:17:37
问题 All of the data on my application is pulled through an API via JSON. The nature of a good percentage of this data is that it doesn't change very often. So to go and make JSON requests to get a list of data that doesn't change much didn't seem all that appealing. I'm looking for the most sensible option to have this JSON saved onto the iPhone in some sort of persistent data store. Obviously one plus of persisting the data would be to provide it when the phone can't access the API. I've looked

Password protect iPhone app

牧云@^-^@ 提交于 2019-12-03 01:15:43
问题 I'm starting a new app, and I'd like to know how to require a password to open it. I was considering a UIActionSheet in the application didFinishLaunchingWithOptions method of the app delegate implementation file, but am unsure how to go about doing so. I'm going to keep trying though. Found this video, which seems pretty helpeful. Now I've got my UIActionSheet to pop up displaying "Enter password," and am trying to figure how to add a keypad to the action sheet. 回答1: I think you may have

How to generate JSON programmatically using JSON framework for iPhone

社会主义新天地 提交于 2019-12-03 00:29:13
I am creating an application in that I need to send a JSON to the server to get some response. How to generate JSON using JSON Framework for iPhone? What are the other possible ways? Create an array or dictionary of objects representing the information you want to send via JSON. Having done that, send -JSONRepresentation to the array/dictionary. That method returns a JSON string, and you send it to the server. For instance: NSDictionary *o1 = [NSDictionary dictionaryWithObjectsAndKeys: @"some value", @"key1", @"another value", @"key2", nil]; NSDictionary *o2 = [NSDictionary