cocoa-touch

Can ABNewPersonViewController be used to edit existing records? [duplicate]

我只是一个虾纸丫 提交于 2019-12-24 11:50:31
问题 This question already has an answer here : Closed 8 years ago . Possible Duplicate: Can ABNewPersonViewController be used to edit existing records? I'm trying to using ABNewPersonViewController to edit an existing record. I set the displayedPerson property and it shows up fine with all the info. If I hit 'Save', everything works as expected. However, if I hit 'Cancel', the record is deleted from the Address Book. I can't use ABPersonViewController since I have a customized contact info page

Have half a UILabel text bold and half not?

浪尽此生 提交于 2019-12-24 11:40:18
问题 I want half of my UILabel 's text to be bold and half to not be bold. How can I do this? 回答1: NSAttributedString allows for specification of formatting within a string, but sadly, UIKit does not yet do anything with this. However, there are a few open-source implementations that do. Check out OHAttributedLabel. 回答2: You can't do this easily unless you subclass UILabel and mess with the subviews. Better to use two UILabels instead. Found another thread about it here. 回答3: UILabel has

iOS 9: push/pop view controller broken by edgesForExtendedLayout

廉价感情. 提交于 2019-12-24 11:36:53
问题 I have found a strange issue while debugging on iOS 9. In my View Controller's viewDidLoad I have this piece of code: if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) { self.edgesForExtendedLayout = UIRectEdgeNone; } When I am pushing or popping a new view controller I have noticed a strange animation. The transition isn't smooth and it seems like it is displaying a "stack" of view controllers (you can notice the top and even slightly a bottom of both images). I had no problem

How to Translate a Delegated Function to a IBAction Function

ⅰ亾dé卋堺 提交于 2019-12-24 11:36:08
问题 I have a delegate function that changes a UITableViewCell's section location on tap: //On cell tap, expand func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { if indexPath.section == 0 { let data = firstDataSource[indexPath.row] tableView.beginUpdates() secondDataSource.append(data) firstDataSource.removeAtIndex(indexPath.row) let newIndexPath = NSIndexPath(forRow: find(secondDataSource, data)!, inSection: 1) tableView.moveRowAtIndexPath(indexPath,

Activity Indicator while loading images inside UIScrollView

谁说胖子不能爱 提交于 2019-12-24 11:35:50
问题 I have UIScrollView that contains images from the server. I should put Activity Indicator while the image is currently loading. UIScrollView contains dynamic number of images from the server. May I know how can I add activity indicators on each page while the image is loading and remove once image is loaded. Here's my code to retrieve images: NSDictionary *items = [NSDictionary dictionaryWithObject:dictInfo forKey:@"images"]; imageList = [items objectForKey:@"images"]; NSArray *img =

Adding an entirely different view behind the current view

江枫思渺然 提交于 2019-12-24 11:35:23
问题 Summary: I am trying to implement a pan gesture that works just like Apple's default pan back gesture (interactivePopGestureRecognizer). The only difference is that it snaps all the way back to the primary view of a splitview controller rather than just going back one view on the stack. This is accomplished with popToRootViewController. What I can currently do: My subclass of the UIScreenEdgePanGestureRecognizer is able to follow the user's touch and animate to the proper location based on

Killing a thread or an alternative

故事扮演 提交于 2019-12-24 11:27:44
问题 Is there any way I can kill a thread spawn through: [NSThread detachNewThreadSelector:@selector(serverFetchInThread) toTarget:self withObject:nil]; The scenario I am working on is that in my main thread I am letting user enter data in my search bar and what ever user is typing I need to send to server for searching in a separate thread. Now, if user changes his selection by deleting old data and entering new data I do not want the previous thread to waste its time, kill it and spawn a new

iOS5: UIScrollView dispaying and scrolling differently from iOS4

这一生的挚爱 提交于 2019-12-24 11:16:54
问题 This is a curious one. I have an IBOutlet UIScrollView playScrollView whose height is exactly 1/3 of it's contentSize's height. The app is in landscape. I call this code... [playScrollView scrollRectToVisible:CGRectMake(0.0f, page * PLAY_VIEW_PAGE_HEIGHT, 480.0, PLAY_VIEW_PAGE_HEIGHT) animated:animated]; ... (the int page ranges from 0 to 2) to start on page 1 (displaying the middle third) then go up or down as needed when the user presses buttons. This works fine for iOS4 both device and

Why does NSDateFormatter return nil?

痞子三分冷 提交于 2019-12-24 10:48:36
问题 Why is lDateFormatted nil on iPhone simulator 3.1.2 after executing this piece of code? NSString *lDateString = @"Wed, 17 Feb 2010 16:02:01"; NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"EEE, dd MMM yyyy hh:mm:ss"]; NSDate *lDateFormatted = [dateFormatter dateFromString: lDateString ]; Any ideas appreciated, Thanks 回答1: You probably want to be using HH for hours, that's 0-23 / military style Also, you may need to put single

UiPickerView change font color according data

拈花ヽ惹草 提交于 2019-12-24 10:38:08
问题 I'm using a pickerView with multiple components related to several fields in a Database (CoreData). Is it possible to change the fontcolor for a specific component according the presence of data in the DB ? For example the field in the DB is null the component font color should be RED otherwise black. Any help will be appreciated ! Dario ================== Thanks Kenny, I have to apply to a single UIPicker only. So I', returning the view parametere (without modificatiosn). The result is all