cocoa-touch

Animating NSMutableAttributedString color - the string disappears

自古美人都是妖i 提交于 2020-01-17 03:50:11
问题 I have a layer and in its drawInContext: I draw an attributed string with drawInRect: . Here's how I initialise the layer. + (id)layer { Character *layer = [[self alloc] init]; if (layer) { NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"Fabada" size:72]}; layer.symbol = [[NSMutableAttributedString alloc] initWithString:@"X" attributes:attributes]; } return layer; } I want to animate the string's color, so I have three dynamics properties. @interface Character :

Does anyone have a good way to scroll text off to one side, like a stock ticker in a label on a nib in an iphone app?

让人想犯罪 __ 提交于 2020-01-17 03:43:25
问题 I want to scroll text starting on the right and make it smoothly move to the left and off the screen. Does anyone have an example of something they tried that worked? Thank You. 回答1: This question is asking something very close to what you want to do. The answers provided there, coupled with the methods described in the answers to this question, should let you scroll text in a smoothly animated manner. 来源: https://stackoverflow.com/questions/900425/does-anyone-have-a-good-way-to-scroll-text

Changing the UITableViewCell swipe action title

╄→尐↘猪︶ㄣ 提交于 2020-01-17 03:34:56
问题 I have a row action button titled "Activate". When I press it, I want the title to change to "Deactivate". I was unable to change the title in the handler function. Also, "Activate" and "Deactivate" should have different functions. func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? { let account = accountTypes[indexPath.section].accounts[indexPath.row] let delete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title:

How do I set up a proxy object in the main application NIB?

非 Y 不嫁゛ 提交于 2020-01-17 03:27:05
问题 I would like to set up a proxy object in the application NIB file. The problem is that the NIB file is the main application NIB that gets loaded automatically by the application and therefore I cannot set up the UINibProxiedObjectsKey dictionary as described in the documentation. Is there a way to set up a proxy object in the main application NIB? Or can I tap into the code that loads the main application NIB? 回答1: My main problem was that I was trying to use Interface Builder as a dependency

Send NSArray Via AirDrop

醉酒当歌 提交于 2020-01-17 03:20:30
问题 I have an NSMutableArray self.certificates This array is made up of saved strings and core data. I want to send this through AirDrop. I have checked out serialization and and im trying to send it with the folowing - (void)send{ NSData *jsonData2 = [NSJSONSerialization dataWithJSONObject:self.certificates options:NSJSONWritingPrettyPrinted error:nil]; NSString *jsonString = [[NSString alloc] initWithData:jsonData2 encoding:NSUTF8StringEncoding]; NSLog(@"Electrical Certificates List:\n%@",

UIAlertview message not Showing properly

流过昼夜 提交于 2020-01-17 03:18:06
问题 I'm having a UIAlertView and declared as UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"NEW_ALBUM" message:@"ENTER_ALBUM_NAME" delegate:self cancelButtonTitle:@"CANCEL" otherButtonTitles:@"Ok",nil]; alert.tag = 999; alert.alertViewStyle = UIAlertViewStylePlainTextInput; [alert show]; [alert release]; the resultant alert was shown as 来源: https://stackoverflow.com/questions/19288340/uialertview-message-not-showing-properly

How to send Push Notification from one iPhone Device to another? [closed]

醉酒当歌 提交于 2020-01-17 01:50:15
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . Is it possible to send Push Notification from one iPhone Device to another? If yes, then can you please show me how it can be done? 回答1: No, you can not send Push Notifications directly between two devices. Push

Need clarification on dispatch_group_wait() behavior when dispatch_group_create() and dispatch_group_enter() are called from different queues

风格不统一 提交于 2020-01-17 01:31:06
问题 I am looking at the Ray Wenderlich tutorial on using dispatch queues to get notified when a group of tasks complete. http://www.raywenderlich.com/63338/grand-central-dispatch-in-depth-part-2 The first code shown under "Code that works" is straight from the tutorial. The Alert view(final completion block) get executed after all 3 downloads complete. I tried to play around with it and moved the dispatch async down in the "Code that does not work" to see what will happen if dispatch_group_create

Obj-C, showing a UIPickerView in an UIActionSheet, but need to save to NSUserDefaults and refresh table contents, but where?

天涯浪子 提交于 2020-01-17 01:17:30
问题 I was using pickerView didSelectRow to save the selected value to NSUserDefaults and re populate my table view. However, at the point the action sheet / picker view is still visible and the user can select new values and didSelectRow will be called again. EDIT: To clarify I don't want to populate my table view at this point. I'm looking for an event when I can save the value and re-populate after the picker view is dismissed. What can I use ? Here's my code to show the action sheet / picker

Unable to Generate UITextField dynamically in place of UILabel?

半城伤御伤魂 提交于 2020-01-17 01:13:33
问题 I am trying to generate UITextField dynamically in place of UILabel. Now i want to update that data. I am displaying data in the UILabel from the database and there is an UIButton for editing. When i click on that UIButton UITextField should be generated in place of UILabel and also data should be displayed in UITextField. 回答1: What you can do is to design a view with all textfield which works in two modes, first readonly (by setting userInteraction to false ) and second editing mode. This