cocoa-touch

I can't get my head round - (void)playInputClick;

别说谁变了你拦得住时间么 提交于 2019-12-30 09:42:15
问题 I have an inputAccessoryView for a UITextField set up, which is loaded from a XIB when needed (in the exact same way as Apple's KeyboardAccessory example). I'm trying to get the buttons on it to click when pressed using the playInputClick function but I can't work out how. The Apple documentation says that I need to add add a delegate method to the view, but the view was created purely in interface builder so I don't see how I can do this. Does anyone know how to make this work? There seems

Understanding when to call retain on an object?

你。 提交于 2019-12-30 09:26:52
问题 When should retain be used ? I understand that it increments the object references count, so basicly the next release on that object will not call dealloc on it. Ok great, so what ? I read around that it's some kind of convention, that if you care about an object, you retain it. Is there any examples of that out there ? Is that even true ? EDIT: I'm not looking for when the debugger tells you to do that or this. So, I looked into this. To put it in my words, here's an example of a retain

Hide UITabBar in iPad Application

一世执手 提交于 2019-12-30 08:50:50
问题 This question has been asked a lot and there are quite a few answers, but none of the answers I can find answer the following: I have a UITabBarController I want to hide the tab bar, so I call: self.tabBarController.tabBar.hidden = YES This removes the bar, but there is now an empty black box where the tab bar used to reside. I've tried resizing the frame of the ViewController that is currently being presented and it is always behind the black box left from the tab bar. I also loop through

UICollectionViewFlowLayout minimumInteritemSpacing doesn't work

删除回忆录丶 提交于 2019-12-30 08:38:30
问题 I've got two problems with my UICollectionView: minimumInteritemSpacing doesn't work it overflows horizontally on iOS 6 I set up the layout like this: UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.itemSize = CGSizeMake(70.0f, 70.0f); layout.scrollDirection = UICollectionViewScrollDirectionVertical; layout.minimumLineSpacing = 0.0f; layout.minimumInteritemSpacing = 0.0f; _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero

Are scheduled UILocalNotifications part of iOS device backup?

£可爱£侵袭症+ 提交于 2019-12-30 08:33:09
问题 I mean, our app schedules a couple of local notifications. User makes a backup of the system and restores it on a new device. Will previously scheduled local notifications fire on the new system, or do we need to reschedule them again on the new system? 回答1: Finally I forced myself to do the test. The result: YES - scheduled local notifications are part of backup , this means they are restored and scheduled on the new device. The restore overwrites any previously scheduled local notifications

NSNumberFormatter for rounding up float values

人走茶凉 提交于 2019-12-30 07:29:30
问题 I have a CGFloat value which I want to round to 3 digits after the decimal point. How should I do this? Thanks. 回答1: NSString *value = [NSString stringWithFormat:@"%.3f", theFloat]; 回答2: If you want to go the NSDecimalNumber route, you can use the following: NSDecimalNumber *testNumber = [NSDecimalNumber numberWithDouble:theFloat]; NSDecimalNumberHandler *roundingStyle = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundBankers scale:3 raiseOnExactness:NO raiseOnOverflow:NO

Displaying UIAlertView after some time

旧时模样 提交于 2019-12-30 07:23:47
问题 I'm trying to display a UIAlertView after some time (like 5 minutes after doing something in the app). I'm already notifying the user if the app is closed or in background. But I want to display a UIAlertView while the app is running. I tried to dispatch_async as follows but the alert is popping forever: [NSThread sleepForTimeInterval:minutes]; dispatch_async(dispatch_get_main_queue(), ^{ UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"title!" message:@"message!" delegate:self

name of UIView that was touched

◇◆丶佛笑我妖孽 提交于 2019-12-30 07:23:09
问题 How can I get the name of the [touch view] in the touchesbegan event. So if it were UIView *aaaaaview I would get aaaaaview as the return; Thank You, nonono 回答1: "UIView *aaaaaView" just refers to a place in memory. So if you had UIView *aView; UIView *anotherView; aView = anotherView; and the user touched a UIView, would the view's name be "aView" or "anotherView"? In particular, a UIView has no knowledge of the name of the variable you use to store it. I think you're going to have to

Timer: how to remain timer active in Background

人盡茶涼 提交于 2019-12-30 07:21:08
问题 In my iPhone Timer Application, In which a timer should run in background. So, I have set the notification in appdelegate it works perfectly... With that I am calling the methods from view controller which makes timer alive. Take a look some code... App delegate - (void)applicationDidEnterBackground:(UIApplication *)application { /* Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its

Will my app get rejected if I place an iAd in a UITableView headerView?

非 Y 不嫁゛ 提交于 2019-12-30 07:06:29
问题 I am displaying iAd's in the headerView of a UITableView. When the user scrolls the iAd disappears because the headerView is no longer visible. I am not sure if this will prevent my app from being accepted. 回答1: As I explained in an answer to your previous question (and another question that was closed as a duplicate): iAd appears in simulator but not on device Apple will reject your application if an iAd is within a table cell. iAds are required to be in a static position on the page, and