cocoa-touch

skpsmtpmessage in different thread

时光怂恿深爱的人放手 提交于 2020-01-24 22:46:25
问题 I have just successfully implemented skpsmtpmessage into my iPhone app. This works fine, but it runs on the main thread, causing the UI to lock up until the operation is complete. Therefore I have tried moving it to a second thread: [NSThread detachNewThreadSelector:@selector(launchJobWithJob:) toTarget:self withObject:jobDescription]; If I do this that way, the class seems to get stuck on the connecting right away, with the only NSLog output being: C: Attempting to connect to server at: mail

How to optimize performance in view controller navigation with UISegmentedControl and UITabBarController

 ̄綄美尐妖づ 提交于 2020-01-24 20:25:39
问题 On a project I'm working on, the design decision was to use a UISegmentControl at the top, with a UITabBarController on the bottom. The UISegmentControl has 3 choices for 3 different views. Currently, my coworker has added all 3 views to an NSArray when that particular tab is selected, and then based on the UISegmentControl, the view selected gets unhidden, and the other two are hidden. It seems to not follow Apple's guidelines of lazy loading and seems expensive since 3 viewDidLoads (where

iOS, native blur view effects available from iOS9+?

一个人想着一个人 提交于 2020-01-24 20:19:08
问题 I'm trying to show a view / popup (a dialog), however I need a blur effect in the background and support iOS 9+. Are they blur operations provided natively in UIKit which will support rotation? I'm concerned that the blur effect will work off a screenshot and once I've shown my dialog and the screen rotates it won't be possible to add a blur effect to the screenshot image. Perhaps there are other options. 回答1: UIKIt has a UIVisualEffectView to add the beautiful blur effects from the object

UITextView or UIWebView with normal words looking like links

蓝咒 提交于 2020-01-24 20:13:27
问题 I was looking at the Twitter for iPhone app and was puzzled. First of all, there are normal words looking like links inside. Second, when I touch those link-like words, the text view (or maybe web view) jumps to the corresponding part below (yes, it doesn't open Safari, it just jumps to the text within that text/web view) Now I want to implement the same effects. I should base my implementation on what? UITextView or UIWebView? How to make normal words look like links? How to make those

How to reload UITableView without stopping cell selection animation

时光总嘲笑我的痴心妄想 提交于 2020-01-24 14:45:12
问题 When the users taps on a cell, I want to update my UITableView ; including the contents of this tapped cell. Easiest way is to update internal parameters and then invoke [self.tableView reloadData]; . However, reloadData immediately stops the nice blue->none selection animation of my tapped cell. Is there a (standard) way to update my table cells without stopping the tapped cell's animation? Note in this case I don't add or delete cells; I just want to contents to change (e.g. start an

How to reload UITableView without stopping cell selection animation

 ̄綄美尐妖づ 提交于 2020-01-24 14:41:05
问题 When the users taps on a cell, I want to update my UITableView ; including the contents of this tapped cell. Easiest way is to update internal parameters and then invoke [self.tableView reloadData]; . However, reloadData immediately stops the nice blue->none selection animation of my tapped cell. Is there a (standard) way to update my table cells without stopping the tapped cell's animation? Note in this case I don't add or delete cells; I just want to contents to change (e.g. start an

Why should I use KVC rather than the simple dot syntax when accessing object properties?

◇◆丶佛笑我妖孽 提交于 2020-01-24 10:14:50
问题 There's the option to go the long way, if an receiver class conforms to the NSKeyValueProtocol: [myInstance setValue:[NSNumber numberWithInt:2] forKey:@"integerProperty"]; or the short way: myInstance.integerProperty = 2; what's the point of this KVC method? When is this useful? 回答1: First, those aren't the same, the second should be: myInstance.integerProperty = [NSNumber numbwerWithInt:2]; if integerProperty is an NSNumber . In general you use the second form when you are doing the most

How do you use AVAudioPlayer to play music while in the background?

倾然丶 夕夏残阳落幕 提交于 2020-01-24 09:40:26
问题 I currently use AVAudioPlayer to play music while in the foreground, but when I press the home button my application goes to the background and the music stops. I set the category for my AVAudioSession to AVAudioSessionCategoryPlayback and set active to YES. Additionally, I added the audio key to UIBackgroundModes in my Info.plist. Is there anything else I need to do to enable background music playback? 回答1: There's apparently a bug in the simulator - it doesn't work there, while it works

How do you use AVAudioPlayer to play music while in the background?

一曲冷凌霜 提交于 2020-01-24 09:40:09
问题 I currently use AVAudioPlayer to play music while in the foreground, but when I press the home button my application goes to the background and the music stops. I set the category for my AVAudioSession to AVAudioSessionCategoryPlayback and set active to YES. Additionally, I added the audio key to UIBackgroundModes in my Info.plist. Is there anything else I need to do to enable background music playback? 回答1: There's apparently a bug in the simulator - it doesn't work there, while it works

Two interfaces in *.h and *.m files

怎甘沉沦 提交于 2020-01-24 06:35:10
问题 Sorry for my English, let speak from my heart :) In one project which I work, I noticed an interesting moment. In *.h file declared interface: @interface FrontViewController : UIViewController ... @end And in *.m file I found another interface. @interface FrontViewController() // Private Properties: @property (retain, nonatomic) UIPanGestureRecognizer *navigationBarPanGestureRecognizer; // Private Methods: - (IBAction)pushExample:(id)sender; @end @implementation FrontViewController ... @end