ibaction

Using IBAction Buttons to Zoom MapView

∥☆過路亽.° 提交于 2019-12-12 07:15:04
问题 I have an issue. My current location is displayed and centered in a map view however the map region doesn't get zoomed in to. I tried taking Rob's advice by taking span and region out of the didUpdateToLocation method but I must not have implemented it right. I don't think it's recognizing my call to setRegion in viewDidLoad and my buttons aren't being recognized. Please check my code below and point out the mistake(s). My goal is to be able to zoom in and out of my location using the

Swift 3: Image does not show when setting isHidden=false

余生长醉 提交于 2019-12-12 04:37:53
问题 I followed a tutorial about how to create an iOS app where a title image and a background image are shown once a button is hit (there are checked as "hidden" in the attribute inspector). I am using Swift 3 and Xcode 8. That's what the code looks like: import UIKit class ViewController: UIViewController { @IBOutlet weak var background: UIImageView! @IBOutlet weak var titleImage: UIImageView! @IBOutlet weak var welcomeBtn: UIButton! @IBAction func welcomePressed(_ sender: UIButton) { background

Trouble Debugging UIButton

荒凉一梦 提交于 2019-12-12 03:07:04
问题 I am having some trouble with debugging a UIButton. There is an error I don't know how to fix. I almost certain it is within this code somewhere. Here is my code: @IBAction func checkButton(sender: UIButton) { if (flashButton.hidden == true){ flashButton.hidden == false flashingImageView.hidden == true }else if (flashButton.hidden == false) { flashButton.hidden == true flashingImageView.hidden == false } if ( "\(randomImageGeneratorNumber)" == "\(currentCountLabel.text)"){

IBAction within UIAlertView xcode 4.3

被刻印的时光 ゝ 提交于 2019-12-12 02:53:28
问题 I have a counter in my app that has a reset button, but instead of resetting immediately after tapped, I want a UIAlertView to popup and have the user tap Reset again as a button in the alert. I'm not entirely well experienced in this so I would ask that your answer just simply add/replace parts of my code below. I'm working on this lol. Thanks for any help! - (IBAction)reset { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"titleHere" message:@"messageHere" delegate: self

How to Pass parameters in IBAction?

你说的曾经没有我的故事 提交于 2019-12-12 00:46:36
问题 I am accessing IBAction programatically & want to pass two parameter with this IBAction call. Can any one suggest easy way... 回答1: IBActions are usually called by user interface elements, and they can't have an arbitrary number of parameters. If you want to call the action method programmatically, you could abuse the sender parameter by passing a dictionary as an argument, holding the actual arguments you want to pass, like so: - (void) foo { [self myAction: [NSDictionary dictionaryWithObject

IBAction UIButton and EXC_BAD_ACCESS

↘锁芯ラ 提交于 2019-12-11 17:44:40
问题 in .h file I write -(IBAction)openShuffleForm; and .m -(IBAction)openShuffleForm{ NSLog(@"XXXXXXX"); } and connect with even touch up inside but when I run my program it error show this message -[UITouchData openShuffleForm]: unrecognized selector sent to instance 0x391cc20 ** What happen I don't know why? 回答1: Did you create the link between the button and the implementation? The implementing class should have an IBOutlet of type UIButton. Bind the IBOutlet to the button in Interface builder

Detecting UIButton touches on a subview

馋奶兔 提交于 2019-12-11 11:42:19
问题 I have added a subview which contains a UIButton control. This subview is added to its superview programatically. I need to perform an action when this button is tapped, but since it's contained within its own subview, I can't hook an IBAction up to the view controller in order to push another view controller. Is there an easy way to detect that the button is tapped and call a method within its super view? 回答1: You can do everything programmatically: [buttonName addTarget:self action:

Button to trigger drawRect to redraw a view

北城以北 提交于 2019-12-11 11:39:18
问题 I have a VC with a subview. At the subview level I have a button. I want the button to result in the view being updated. The IBAction code is in the VC. All it currently does is toggle a BOOL value. Back in the subview drawRect: method is the code that tests the BOOL and changes the view accordingly. My observation is that when the button is pressed, the IBAction code runs, toggles the BOOL , but the drawRect: method doesn't get called. I tried calling drawRect manually (not good practice and

Is @IBAction just a syntax in Swift or does @Something mean a particular thing in Swift?

孤人 提交于 2019-12-10 22:34:08
问题 Is @IBAction just a syntactical difference in Swift or does it signify something specific. Also, similar usage is seen in AppDelegate.swift where @UIApplicationMain is written. 回答1: These are attributes in swift.They have some special meaning for compiler.For eg: @UIApplicationMain synthesize main.swift file by compiler as entry point for application.From swift guide Attributes provide more information about a declaration or type. There are two kinds of attributes in Swift, those that apply

Using Interface Builder efficiently

安稳与你 提交于 2019-12-10 20:04:08
问题 I am new to iPhone and objective c. I have spent hours and hours and hours reading documents and trying to understand how things work. I have RTFM or at least am in the process. My main problem is that I want to understand how to specify where an event gets passed to and the only way I have been able to do it is by specifying delegates but I am certain there is an easier/quicker way in IB. So, an example. Lets say I have 20 different views and view controllers and one MyAppDelegate. I want to