cocoa-touch

Reusing UIViewController for modal and non-modal situations

廉价感情. 提交于 2020-01-02 04:45:07
问题 I have a UIViewController — let's call it "FormController" — which is simply a form that edits an object. I want to use it in 2 different situations: Creating a new object — using using UINavigationController's presentModalViewController: method. Editing an existing object — push the view controller onto the UINavigationController stack, not using a dialog method. There is a slight difference in that in the modal situation I would like to have a toolbar with "Cancel" and "Done" buttons,

Why won't my x-axis show with core-plot on the iPhone?

…衆ロ難τιáo~ 提交于 2020-01-02 04:42:06
问题 EDIT: I think my question is better phrased as: How can I have a Y-axis that doesn't start at zero? It seems like the x-axis always gets placed at the y=0, but I would like the x-axis to be at some positive number on the y-axis. Here's a graph with more regular data... I just wish the x-axis was placed at the minimum y-value for the plot (about 77), instead of at 0. Here is the function I use to create the graph. It's a whole bunch of code, and I'm not quite sure which piece might be off to

Dial a number using Phonegap in IPhone

我的梦境 提交于 2020-01-02 04:37:29
问题 I need to Make a call to a phonenumber using a PhoneGap Application in IPhone. Here is the code that I am using which is not working <a href="tel:+1-800-275-2273" style="width:300px;height:67px;margin-bottom:20px;"><img src="image.png" alt="" /></a> Also I am using childbrowser and mapkit plugin in the app. Can anyone tell me how should I make a call using Phonegap in Iphone app ? Thanks in advance. 回答1: I just tried it (copy and paste) without an image but with just text, it tried to dial

Sample example for Speech to Text in iOS

那年仲夏 提交于 2020-01-02 04:31:10
问题 I am new to iOS programming.Can you please tell me how to convert the speech to text in iOS?Is there any API called?Please suggest me how to proceed? 回答1: There are several libraries for this kind of conversion - I host two of those on GitHub: libsprec (this uses the Google speech recognition APIs, so it supports multiple languages) and VocalKit which uses the high-quality opensource PocketSphinx library (however, it currently supports English only). OpenEars uses PocketSphinx as well. There

UITableViewCell Reusability causing Problems [with images] !

对着背影说爱祢 提交于 2020-01-02 04:28:06
问题 A picture is worth a thousand words, and I am guessing that the pictures posted below clearly convey the problem I am facing now. Here's a little summary: I create a tableView, and each tableViewCell has a textField as a subview. I scroll up and down, and my view gets messed up. I am guessing it is because of Cell Reusability . But I need help with this. Note : This problem is not because of the buttons or the uitextView at the bottom of the screen. If I do not have them, and I have only the

Objective-C - Parsing a CSV into a array

為{幸葍}努か 提交于 2020-01-02 03:15:05
问题 How would I parse a CSV into an array. Its only a one column spread sheet I converted into an CSV so it shouldn't be too hard right? Any way how do I do this? 回答1: Use a proper CSV parser such as https://github.com/davedelong/CHCSVParser 回答2: you can do this new_array *new_obj = [csv_array componentsSeparatedByString:@","]; Hope it helps!!!! 来源: https://stackoverflow.com/questions/3286254/objective-c-parsing-a-csv-into-a-array

iOS - Async NSURLConnection inside NSOperation

守給你的承諾、 提交于 2020-01-02 02:43:06
问题 I know this question was asked many times on SO, but I didn't manage to make it work in my project... So, I want to subclass NSOperation and make it download a file using NSURLConnection . What is the right way to do it? here is my code which doesn't work: First, I'm adding all my operations in a loop: DownloadFileOperation *operation; NSOperationQueue *queue = [[NSOperationQueue alloc] init]; for (int i=0; i<10; i++) { operation = [[DownloadFileOperation alloc] init]; operation.urlString =

iOS: Using the app delegate to house global variables

大兔子大兔子 提交于 2020-01-02 01:35:47
问题 Is it bad practise to house variables that I want to be accessible from all classes in the app delegate and get them via [[UIApplication sharedApplication] delegate] someProperty] 回答1: The real solution to your question isn't to replace one form of global state with another (i.e. singletons). What you should be doing is putting state within "model" classes that are instantiated inside your app delegate, and then passing them down to the parts of your application that need them (e.g. view

Why is self.navigationItem.backBarButtonItem always nil?

走远了吗. 提交于 2020-01-02 01:01:15
问题 I push a view controller onto a navigation controller like this: [self.navigationController pushViewController:anotherViewController animated:YES]; And, then, inside anotherViewController I check self.navigationItem.BackBarButtonItem and LeftBarButtonItem, but they are always nil. I can see the backBarButtonItem, and it seems to work fine. 回答1: From the Documentation: "When this item is the back item of the navigation bar—when it is the next item below the top item—it may be represented as a

UISlider inside UIPageViewController

做~自己de王妃 提交于 2020-01-02 00:56:09
问题 I have a PageViewController which is initialized like this: self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; On one of the pages, there's a UISlider. My problem is that when I have transitionstyle set to UIPageViewControllerTransitionStyleScroll , it takes 150-200 ms before beginTrackingWithTouch is invoked on the slider. This