I am currently making a demo iOS app for practice in swift and I have run into an issue. I just created a new page and there is only one button on this page. I have linked the button to an IBAction function and it shows a proper connection.
I would show you a screen shot but I do not have enough reputation (every other issue I have ever had I could find a post from someone else).
It even shows the circle with a filled in dot and when clicked it shows the correct button. In the connection inspector it shows under sent events a connection between "Touch Up Inside" and "UserPage btnProgressClick" (Userpage is my class that extends UIViewController and is referenced by this particulate View Controller and btnProgressClick is the name of the IBAction function I want to run).
I found this post and I tried a clean build but that did not work. I also moved my button around and it updated properly in the simulator.
The code inside btnProgressClick is never executed. I have put a breakpoint at the first line and it does not break.
Here is the "Main.storyboard" XML code that links the button to the function.
<!--User Page-->
<scene sceneID="aNb-aX-hZF">
<objects>
<viewController storyboardIdentifier="UserPage" id="w2h-zR-Kdu" customClass="UserPage" customModule="GenomeTrackerDemo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="9dS-Hw-ZYg"/>
<viewControllerLayoutGuide type="bottom" id="7PS-pA-lFe"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="w6A-eT-aKv">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JGD-xx-tMQ">
<rect key="frame" x="20" y="48" width="46" height="30"/>
<state key="normal" title="Button"/>
<connections>
<action selector="btnProgressClick:" destination="w2h-zR-Kdu" eventType="touchUpInside" id="F1N-QY-fhb"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Fsq-L4-Are" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1043" y="426"/>
</scene>
and here is the UserPage Class:
import Foundation
import UIKit
class UserPage: UIViewController {
var thisUser: User = User()
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func btnProgressClick(sender: UIButton) {
let storyboard = UIStoryboard(name: "Main", bundle:nil)
let vc: progressPage = storyboard.instantiateViewControllerWithIdentifier("progressPage") as! progressPage
UIView.transitionFromView(self.view, toView: vc.view, duration: 0.8, options: UIViewAnimationOptions.TransitionFlipFromRight, completion: nil)
}
}
As I said before this is my first question so I am open to feedback on how it was worded and what information I gave.
I would like to add some information about how this page is called. It is called after an Async call to a web service. After the data is successfully brought back I transition to the page with this function:
func afterSuccessfulLogin(thisUser: User){
dispatch_async(dispatch_get_main_queue()){
let storyboard = UIStoryboard(name: "Main", bundle:nil)
let vc: UserPage = storyboard.instantiateViewControllerWithIdentifier("UserPage") as! UserPage
vc.thisUser = thisUser
UIView.setAnimationCurve(.EaseIn)
UIView.transitionFromView(self.view, toView: vc.view, duration: 1.2, options: UIViewAnimationOptions.TransitionFlipFromRight, completion: nil)
}
}
not sure if this makes a difference but I figured I would throw this in there.
Any help on this issue would be very useful.
Thanks!!