cocoa-touch

UITableView Not Respecting heightForHeaderInSection/heightForFooterInSection?

你离开我真会死。 提交于 2019-12-28 12:15:38
问题 I have a UITableView where in some instances, certain sections have zero rows. My goal is that when this is true, I don't want any wasted space in the table view, it should look like there's no data. The problem I'm having is with the header and footer for the sections, which are showing even if there's no row and despite me overriding the delegate method to return 0.0f. Here's what it looks like - you can see the ~20p of gray space at the top there, headers and footers of about 10p each for

iOS: How to copy HTML into the cut-paste buffer?

末鹿安然 提交于 2019-12-28 12:08:31
问题 I'm interested in letting my users copy the text they've entered into the cut-and-paste buffer, but I'd like to do that as HTML. Is such a thing even possible? Or do I need to use a MIME format? (I have no idea.) Thanks. 回答1: The following code will get your HTML out of your app and into Apple's Mail app. The documentation doesn't give you a great deal of help on this, so in part it's a matter of looking at what Apple's apps park on the pasteboard and then reverse engineering that. This

Is there any way to get the neat Objective-C literal indexing feature in Xcode 4.4?

筅森魡賤 提交于 2019-12-28 11:57:33
问题 I read all about the new Objective-C literals, and used Xcode to convert my old code, but the indexing code didn't change. I changed it by hand but then it wouldn't compile. I saw a post that said we have to wait until iOS 6, but I want the indexing NOW! Is there any solution? 回答1: Well, there is a way to do it! Add the indexing methods as a category to NSArray and NSDictionary, and you can get the feature for most of the classes you'd want it for. You can read up on ObjectiveC literals here.

Is there any way to get the neat Objective-C literal indexing feature in Xcode 4.4?

做~自己de王妃 提交于 2019-12-28 11:57:05
问题 I read all about the new Objective-C literals, and used Xcode to convert my old code, but the indexing code didn't change. I changed it by hand but then it wouldn't compile. I saw a post that said we have to wait until iOS 6, but I want the indexing NOW! Is there any solution? 回答1: Well, there is a way to do it! Add the indexing methods as a category to NSArray and NSDictionary, and you can get the feature for most of the classes you'd want it for. You can read up on ObjectiveC literals here.

iPhone Development: how to use custom fonts?

穿精又带淫゛_ 提交于 2019-12-28 11:57:02
问题 I used a special font in my photoshop design, is it possible to use these fonts natively in the iphone app? or do I need to convert them into an image first? If this is the only way to do it, what do you do with dynamic text? 回答1: UIFont *font = [UIFont fontWithName:@"MyFont" size:20]; [label setFont:font]; Where "MyFont" would be a TrueType or OpenType file in your project (sans the file extension), and label would be an instance of UILabel. 回答2: Copy your font file into Resources In your

Seek to a certain position in AVPlayer right after the asset was loaded

冷暖自知 提交于 2019-12-28 11:47:07
问题 This works: I have an AVPlayer which plays a video right after it was loaded. And this works fine. This doesn't : Instead of starting the video at the beginning, I want to play it at a given position. So I wait until the asset is ready for Play using KVO: BOOL isReadyToSeek = (self.playerItem.status == AVPlayerStatusReadyToPlay) And then seek to the given time [playerItem seekToTime:timeInTheMiddleOfTheVideo completionHandler:myHandler]; But the player will always start at the beginning of

adding more than two button on the navigationbar

我们两清 提交于 2019-12-28 10:06:35
问题 I am trying this but it does not work. -(void)viewDidLoad { // create a toolbar where we can place some buttons UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 45)]; [toolbar setBarStyle: UIBarStyleBlackOpaque]; // create an array for the buttons NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3]; // create a standard save button UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target

Sequence animation using CAAnimationGroup

若如初见. 提交于 2019-12-28 06:22:07
问题 I'm trying to make a sequence of animations, I've found in CAAnimationGroup the right class to achieve that object. In practice I'm adding on a view different subviews and I'd like to animate their entry with a bounce effect, the fact is that I want to see their animations happening right after the previous has finished. I know that I can set the delegate, but I thought that the CAAnimationGroup was the right choice. Later I discovered that the group animation can belong only to one layer,

Push Notification -didFinishLaunchingWithOptions

痴心易碎 提交于 2019-12-28 05:52:34
问题 When I send a push notification and my app is open or in the background and I click on the push notification, my application redirects to PushMessagesVc viewController ( as intended ) I use the code as below for this: -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { UIStoryboard *mainstoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; PushMessagesVc *pvc = [mainstoryboard instantiateViewControllerWithIdentifier:@

Crashlytics iOS - log caught exception

戏子无情 提交于 2019-12-28 05:16:27
问题 Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. I found a way to log custom caught exceptions in the Crashlytics Android SDK, but I can't find anything like that for the iOS SDK. Is there a way to log a caught exception with Crashlytics on iOS? See Android explanation: http://support.crashlytics.com/knowledgebase/articles/202805-logging-caught