ibaction

Trigger button to change text in UITextView in swift3 xcode 8 ios 10

青春壹個敷衍的年華 提交于 2021-01-27 12:23:36
问题 I'm new to xcode and am stuck on this problem, because after trying several sample code examples online, nothing works. Could you help me figure out what the problem is? My code below: import UIKit class ViewController: UIViewController { @IBOutlet weak var Writingboard: UITextView! @IBOutlet weak var Talkbutton: UIButton! @IBAction func TalkbuttonTapped(_ sender: AnyObject){ Talkbutton.setTitle("Tap to Stop", for: .normal) Writingboard.text="talking" } override func viewDidLoad() { super

UIButton event 'Touch Up Inside' not working. 'Touch Down' works fine

我是研究僧i 提交于 2020-01-15 05:33:26
问题 I've got a UIButton in a UIView, which is in a UIViewController that I've allocated and inited from a .xib file. When hooking an IBAction up to the 'Touch Down' event of a UIButton it triggers correctly. But if I hook it up to the 'Touch Up Inside' event it doesn't respond. Other events don't work either. 'Touch Drag Enter', 'Touch Drag Exit', 'Touch Up Outside' etc. Only Touch Down. Does anyone have any idea why this might be? Rich 回答1: First, I can absolutely, positively guarantee you that

Disable scrolling via IBAction contained in subview

我只是一个虾纸丫 提交于 2020-01-14 06:27:07
问题 My iPad app is currently built as such: xml data is pulled from my website and parsed in a View Controller "FishIDView". This view controller has a UIScrollView "scrollView" that has a subview "XMLView" which is a UIView. scrollView is setup so that it scrolls and pages through the XMLViews based on the number of items contained in the XML. For example 12 items = 12 pages, or instances of XMLView. These pages contain photos of individual fish. Each of these pages contain a button that creates

Custom UITableViewCell and IBAction

倖福魔咒の 提交于 2020-01-09 19:38:10
问题 I have a custom UITableViewCell on which I have added a button, I have associated that button on an IBAction in my viewController. Now the problem that i am facing is how do I know from which cell that button was created. When I present my viewController which has a table in it and has multiple rows (custom UITableViewCell), now when the user presses the button the action is getting called, but how do I know which row was it. Because based on the row index I need to store some value. Edit: I

Using a Button to change an Image in a UIimageView in a separate ViewController

巧了我就是萌 提交于 2020-01-06 08:38:10
问题 I have several different buttons, which are all segued modally to another ViewController that contains several UIimage views. What I'm trying to do is to create an IBAction for each button that will set images to the UIimageViews in the other ViewController. (my UIimageViews are @property(nonatomic, retina) and I have tried multiple codes like "setImage" and many others with no success) I wass wondering if this could be done by using tags? THANKS!!! 回答1: Use Delegates delegate. On button

I need to open a local PDF using Adobe Reader app via an IBaction using a Button

喜夏-厌秋 提交于 2019-12-25 12:26:14
问题 I have been searching for days for a solution to my problem and cant find exactly what I need. I have created an interactive PDF that needs to be viewed in Adobe Reader (the app is on the ipad). I have multiple view controllers I need to add a universal button to that will open Adobe Reader to show the pdf (via popover to the app or embedded, embedded preferred). Currently when i click my button, the screen just slightly dims, then goes back to normal after a second touch. Based on what im

IBAction in UIView - Compatible with MVC?

两盒软妹~` 提交于 2019-12-25 06:59:14
问题 I'm trying to understand the implementation of the MVC-Pattern in iOS Apps with Objective-C. Right now I have a DataProvider object which holds and provides my data to other objects in my application (Model). Furthermore I have a View (.xib) with an additional class ( UIView ; lets call it "ViewClass"). I told my view to be a subclass of my ViewClass so that I'm able to create IBOutlet s to my subviews like labels and IBAction s to my buttons. So this is obviously my View in the MVC-Pattern.

Toggling MapKit Overlays On/Off by pressing the same button?

北城以北 提交于 2019-12-24 00:48:35
问题 I have a MapView with a toolbar button that when pushed adds overlays to the MapView. What I would like is for the button (IBAction) to check to see if there already are overlays on the map and if there are remove, if there are not, to add them. My current code that adds the overlays is as follows: - (IBAction)waterWaysAction:(id)sender { NSLog(@"WaterWays pushed"); if ([mapView overlays]) { [mapView removeOverlays:[mapView overlays]]; NSLog(@"WaterWays removed"); } else { // ******* adds the

When should I use anyObject insted of UIButton in swift?

ぃ、小莉子 提交于 2019-12-22 10:25:20
问题 When should I use anyObject insted of UIButton in swift? I am making an IBAction for my button that will be used to do more than on task on of the tasks is to switch to the next view. 回答1: Ultimately, it really doesn't matter. You can choose to use the parameter of (sender: AnyObject) or you can use (sender: UIButton) . There might be times however where you might have to cast AnyObject as a UIButton if you need access to the properties provided by UIButton . For example let's say you have

Programmatically generating UIButtons and associate those with IBAction

喜夏-厌秋 提交于 2019-12-20 10:33:13
问题 How do I do if I want to programatically generate a set of buttons and then associate those with IBActions? It's easy if I add the buttons in Interface Builder, but that I cannot do for this case. 回答1: The buttons have the method - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents . The code to use this would look like this: UIButton *myButton = [[UIButton alloc] init...]; [myButton addTarget:something action:@selector(myAction) forControlEvents