cocoa-touch

Initializer element is not a compile-time constant error

这一生的挚爱 提交于 2019-12-25 08:57:37
问题 I am implementing IIViewDeckController into my app. When I am trying to replace the IBAccount to go to that screen I get an error: Initializer element is not a compile time constant The first section of the code is what I have now, and the UIViewController is from the IIViewDeckController that I want to use to load the FirstAccountViewController over. -(IBAction)account{ FirstAccountViewController* ab=[[FirstAccountViewController alloc] init]; [self.navigationController pushViewController:ab

Swift - Custom TableView Not Executing Click on UIButton

送分小仙女□ 提交于 2019-12-25 08:56:53
问题 I am trying to do what I believed was a simple task using Swift. I have created a Custom TableView Cell and added a button to it. I want to be able to just see when you click on the button some action take place. Unfortunately, when I click on the button there is nothing happening. Can someone shed some light on this? I have placed the code below: Custom TableView Cell: import UIKit class TestTableViewCell: UITableViewCell { @IBOutlet weak var testBtn: UIButton! override func awakeFromNib() {

UIScrollView dynamically resize UILabel

随声附和 提交于 2019-12-25 08:56:10
问题 i have got a UILabel which is not static. I want to resize my scroll view so that it fits the label. Here is my idea now: self.scrollView.contentSize = CGSizeMake(320.0, 92+self.contentLabel.frame.size.height); 92 stands for pixels from where my label start. (there is a heading too) But it doesn't work, it seems to be connected with Interface Builder also. Thanks guys. 回答1: You need to set the frame as well. The contentSize of the scrollview is just what is within, not the frame of the view

How to compare Chinese strings in English environment?

牧云@^-^@ 提交于 2019-12-25 08:49:57
问题 I'm trying to compare Chinese strings with NSString - (NSComparisonResult)localizedStandardCompare:(NSString *)string method. It works correctly if the system language is set to Chinese. But in English language environment, the strings is compared by something like unicode number. How can I compare strings with Chinese style in English environment? 回答1: Use - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range locale:(id)locale instead. 来源

Access to an IBOutlet in a modal view's parent view

孤人 提交于 2019-12-25 08:39:47
问题 I have an iOS app where my architecture is: VC1 => MVC1 I want to access to an VC1's IBOutlet (aboutBtn). I tried making a delegate in MVC1 and setting VC1 as delegate, but I still can't access it. How would I do it? 回答1: I would just create an instance variable in MVC1 and pass the IBOutlet variable you're trying to access from VC1 to MVC1. For example, you could call something like MVC1.referenceToSomeIBOutlet = self.someIBOutlet from VC1. That will give MVC1 access to the passed in

How can I display a waiting progress bar before the application started on an IPhone

只愿长相守 提交于 2019-12-25 08:25:51
问题 It takes a long to start up the application I write on an iPhone. I hope to display a waiting progress bar to indicate the percentage of the startup progress. Can anyone help me? I am new to the Development of IOS. 回答1: You can't. The application needs to be started before you can show any dynamic content. After your first ViewController is loaded you can of course show a progress bar and do loading. Before that, you can only show a static image Default.png & Default@2x.png. If you delay the

Uploading Image to the web service - Beginner

本秂侑毒 提交于 2019-12-25 08:23:43
问题 I have to upload an image taken via the camera or uploaded via uiimagepickerview . I am using ASIHTTPRequest. ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setFile:@"/Users/ben/Desktop/ben.jpg" forKey:@"photo"]; 1.) Since i am taking the photo from the iPhone camera or uploading it from the uiimagepickerview , i need to know what value should i set for setFile (replacement text for @"/Users/ben/Desktop/ben.jpg" ) ? 2.) I also need to test this application, so

How to encode a value passed through a delegate using NSCoding

最后都变了- 提交于 2019-12-25 08:08:34
问题 I'm really new using the NSCoding functionality, I'm trying to create persistence of data of an attributedString, particularly a UIColor that is passed through a delegate. I haven't found a tutorial that encodes values that are not declared and initialized in the same class in which the NSCoding protocol is conformed. I have the following code, which is the method that conforms to the protocol I created, and assigns the passed color value as an attribute to the attributedString. func

Adding NSDecimalNumbers not quite working

你离开我真会死。 提交于 2019-12-25 08:04:09
问题 I have this code: NSLog(@"Count of items we will loop through is: %d",[self.defaultBudgetItemsArray count]); id object; while (object = [e nextObject]) { if ([object objectForKey:@"actualCost"]) { currentTotal = [currentTotal decimalNumberByAdding: [object objectForKey:@"actualCost"]]; NSLog(@"decimalNumberByAdding gives: %@",[numberFormatter stringFromNumber:[currentTotal decimalNumberByAdding: [object objectForKey:@"actualCost"]]]); NSLog(@"Trying to add: %@",[numberFormatter

How to create an directory inside the documents directory of my iPhone app?

狂风中的少年 提交于 2019-12-25 07:58:46
问题 I would like to store files in a specific directory inside the documents directory, so that I can iterate over all these files and show them to the user for selection. Is that possible? 回答1: Yups,You can do it like: NSString *rootString = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) objectAtIndex:0]; self.root = [rootString stringByAppendingPathComponent:@"DirectoryName"]; NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager