cocoa-touch

On Objective-C/Cocoa Key-Value coding and arrays

大憨熊 提交于 2020-01-13 05:47:53
问题 I'm trying to work out the "correct" way to handle populating an array with key-value coding for an iPhone app. I've come up with something that works, but it's fairly hackish. Basically I'm parsing an XML document into a set of code-generated models. Let's assume the XML is of this format: <foo> <bar> <item name="baz" /> <item name="bog" /> </bar> </foo> On my generated object that represents the Bar element, I have an NSMutableArray defined for the sub-node: @interface Bar : NSObject {

UIApplication scheduledLocalNotifications is empty for past non-repeating notifications

久未见 提交于 2020-01-13 04:55:26
问题 I have tried out the 3do app which seems to be able to schedule non-repeating notifications and have specific notifications from notification center deleted. It works as this: when app is in background they are delivered in notification center, if you choose one of these notifications 3do will open and you have the option to tap "done", if you tap "done" that specific notification will be removed from the notification center. If you don't tap anything the notification will be left in

Why isn't my UIButton responding to touches?

丶灬走出姿态 提交于 2020-01-13 04:49:29
问题 I'm sure I'm overlooking the obvious as I've got countless working buttons...but...for whatever reason this one is not cooperating... I've added a UIButton (Rounded Rect) to a UIView subclass (DialogView) which is a subview of my view controller's view. This subview is created almost entirely in IB. I've wired up the button to (IBAction)okButtonPressed:(id)sender in IB to Touch Up Inside and created a corresponding method in DialogView. However when I "touch" this button it doesn't trigger

Why isn't my UIButton responding to touches?

为君一笑 提交于 2020-01-13 04:48:13
问题 I'm sure I'm overlooking the obvious as I've got countless working buttons...but...for whatever reason this one is not cooperating... I've added a UIButton (Rounded Rect) to a UIView subclass (DialogView) which is a subview of my view controller's view. This subview is created almost entirely in IB. I've wired up the button to (IBAction)okButtonPressed:(id)sender in IB to Touch Up Inside and created a corresponding method in DialogView. However when I "touch" this button it doesn't trigger

NSDate and NSDateFormatter issues

与世无争的帅哥 提交于 2020-01-13 03:52:12
问题 I'm having slight difficulty in understanding why the following code is crashing an app of mine: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MMMM d, yyyy"]; NSDate *date = [dateFormatter dateFromString:cDate]; datePicker.date = date; NSString *dateStr = [dateFormatter stringFromDate:date]; [dateLabel setText:dateStr]; [dateFormatter release]; If I comment the above out, app is fine. Also if I change the date format to the following no crash

Best way to measure download speed on iPhone using cocoa touch

依然范特西╮ 提交于 2020-01-13 03:15:30
问题 Im making an app where one of the features I want to offers is to measure de download speed of the connection. To get this I`m using NSURLConnection to start the download of a large file, and after some time cancel the download and make the calculation (Data downloaded / time elapsed). While other apps like speedtest.net give a constant speed every time, mine fluctuates 2-3 Mbps more or less. Basically what I`m doing is, start the timer when the method connection:didReceiveResponse: is called

Addresponse - adding to memory only (XCode)

不问归期 提交于 2020-01-13 02:56:08
问题 I'm trying to connect my project to a php file but every time this shows: ADDRESPONSE - ADDING TO MEMORY ONLY I have never seen it before. this is the code i Use: //Gets the php FindURL = [NSString stringWithFormat:@"http://domain.com/Myfile.php?username=%@", Username.text]; // to execute php code URLData = [NSData dataWithContentsOfURL:[NSURL URLWithString:FindURL]]; // to receive the returend value DataResult = [[NSString alloc] initWithData:URLData encoding:NSUTF8StringEncoding]; NSLog(@"%

Property name starting with 'new' prefix leads to BAD_ACCESS error in iOS

孤街醉人 提交于 2020-01-13 01:34:41
问题 My property was declared in my NSManagedObject class with name "newPrice", which leads to "zombie object". After some hours of debugging I figured out that there is problem with method which is releasing this object but not retaining it. After renaming this property to "priceNew" everything goes well. I don't understand why this is causing problem. Declaration of property: @property (nonatomic, retain) NSNumber * newPrice; This call causing problem: [self setPieceStateWithPrice:self.action

After updating to iOS 7 all views in iOS 6 moved up and are hidden by the navigation bar

拟墨画扇 提交于 2020-01-12 14:31:15
问题 I have updated my iPhone to iOS 7 today and recompile my app for it and all views in .xib files and on device are moved up and their upper part is hidden by the navigation bar. In my viewController I set self.edgesForExtendedLayout = UIRectEdgeNone; and on iOS 7 now everything looks good but when I compile my project with Deployment Target 6.0 and tested it on iOS 6 device all views are hidden by the navigation bar again.How can I make them to look consistently on iOS 7 and iOS 6

custom tableviewCells for UITableView created programatically in storyboard [closed]

你。 提交于 2020-01-12 14:23:07
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . In my app I am using storyboard. But I created a UITableView programmatically instead of dragging from Object Library. And now I want