ibaction

Send action from NSTextField when on key up instead of return

倖福魔咒の 提交于 2019-12-10 19:49:50
问题 I want to show the number of characters left for a new tweet, after a key has been lifted. Currently, this only happens if return is lifted: - (IBAction)updateCharacterCountFromNewTweetField:(id)sender { [newTweetCharacterCount setIntValue:140 - [[sender stringValue] length]]; } This action is connected to an NSTextField (NOT A UITextField!!): This is terrible for users, because they want to see the character count immediately, not just after pressing return. Can anyone help me out? Thanks.

IBDesignable… adding custom actions?

允我心安 提交于 2019-12-10 18:54:57
问题 I'm new to Xcode and I assume there's a way to do it but I can't seem to figure it out. I have made a custom control by subclassing UIView and using IBDesignable. However, I can't seem to figure out how to send events from within my control to a IBAction outside of it. 回答1: You need to subclass UIControl not UIView. Once Interface Builder sees an UIControl subclass then send events section and actions will be available. Accessing the Control’s Targets and Actions 来源: https://stackoverflow.com

How to send user to Facebook page on button click

坚强是说给别人听的谎言 提交于 2019-12-10 14:05:27
问题 I'm new to iOS development so please bear with me.. I'm in the process of creating a simple app. There is a facebook button and I'd like that button to send the user to my facebook page, either in the browser or if they have the facebook app open that up. I know there's probably a lot to explain, but if someone could point me in the right direction that would be great, thanks. 回答1: As of the 4.0 update for Facebook, you can jump to pages with this URI schema: fb://page/{fbid} Just make sure

iOS, unrecognized selector sent to instance?

会有一股神秘感。 提交于 2019-12-10 13:17:17
问题 I got a mainscreen with a imported custom actionBar. I created this actionBar in a separate .xib file, with a .m and .h file. I do some graphic setup in my actionBar.m's viewDidLoad like backgroundColor and some other stuff. I also got a button on this actionBar i linked the way i usually link buttons, with a IBAction . I load my actionBar into my mainscreen like this: ActionBarWithLogoff *actionBar = [[ActionBarWithLogoff alloc] initWithNibName:@"ActionBarWithLogoff" bundle:nil]; [topBar

User Interface commands skipped in IBAction

雨燕双飞 提交于 2019-12-10 11:27:35
问题 Here is my code: -(IBAction)saveDownloadedImage { NSLog(@"Test"); EXECUTED indicatorView.hidden = NO; NOT EXECUTED [indicatorView startAnimating]; NOT EXECUTED [statusLabel setText:@"WHY?"]; NOT EXECUTED [currentPicture setImage:[imageView image]]; EXECUTED ImageFileManager *fileManager = [[ImageFileManager alloc] init]; EXECUTED [fileManager saveImageToDisk:currentPicture]; EXECUTED indicatorView.hidden = YES; [statusLabel setText:@"Image saved successfully."]; EXECUTED saveButton.enabled =

NSButton Multiple clicks

只谈情不闲聊 提交于 2019-12-10 11:12:02
问题 I have an IBAction of when the button is clicked to change my view. How can I handle multiple clicks for example if I click the button a second time to cause another action? Or do I need to delete the button after it has been clicked and then create a new one in its place? If so how do I handle the click event? 回答1: You can check the clickCount of the mouseDown event: if ([event clickCount] > 1) { // ... do double-click action } else { // ... do single-click action } 来源: https://stackoverflow

What order do two IBActions fire when called from the same component?

社会主义新天地 提交于 2019-12-10 10:03:56
问题 I have a UIButton and I am trying to call 2 different actions from one UIButton event, since that button needs to do two things, but I need to do them in a certain order. No matter how I try, I can't seem to change the order in which the Actions fire. Is there a way for me to decide this, or is it random? In what order do IBActions get fired from the same component? Is there a way to call them in a certain order? 回答1: Why not create a single, new method that is called by the button and runs

Animate UIButton Down - Xcode

自作多情 提交于 2019-12-09 19:25:56
问题 I wanted to know how I would go about animating a UIButton down when clicked via -(IBAction) Thanks in advance! 回答1: Inside your IBAction UIButton *button = (UIButton*)sender; //animates button 25 pixels right and 25 pixels down. Customize CGRect newFrame = CGRectMake(button.frame.origin.x + 25, button.frame.origin.y + 25, button.frame.size.width, button.frame.size.height); [UIView animateWithDuration:0.3f delay:0.0f options: UIViewAnimationOptionCurveLinear animations:^{ [button setFrame

can multiple buttons be attached to a single IBAction is Xcode 8?

这一生的挚爱 提交于 2019-12-08 10:17:44
问题 I have tried to connect several buttons to a single IBAction in Xcode 8 however it does not work. I tried the practices outlined here Xcode8 cannot connect multiple/single uibuttons to single @IBAction in swift file still to no avail. can anyone shed some light as to why or if it is simply still just a bug? 回答1: Works fine for me in Xcode 8.1 on a new Swift 3 project. You have to control-drag from the button to the center side of the method to select it if it already exists rather than drag

a button in UITableviewCell [closed]

别等时光非礼了梦想. 提交于 2019-12-07 20:24:34
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago . I have UItableViewCell created with a nib file, and have put in my cell a button. i hace created an IBAction to associate an action when the the user click the button.but i have a crash and i don't know what it is the problem, i have set all the things necessary. //in my .h -(IBAction)go; //in my