iboutlet

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

Exception on outlet connections in Xcode 4

拟墨画扇 提交于 2019-12-12 04:15:50
问题 I have created a new iPhone project in Xcode 4 and added some files (xib and classes) from an old project which was created in Xcode 3 which works fine. The project compiles fine with no errors or warnings. However, when I try to run it I get the infamous "NSUnknownKeyException reason: class is not key value coding-compliant for the key dateOutlet" error. When I opened the XIB file the connection to the dateOutlet seemed just fine, but I deleted and reconnected anyway just to be safe. Next

Can't link connector from IBOutlet to View Controller

Deadly 提交于 2019-12-12 03:13:52
问题 I have created files AViewController.h and AViewController.m, for a view controller - I have set the custom class of this view controller to AViewController . I have an object defined in AViewController.h, which is an instance of another class B as: @property (weak, nonatomic) IBOutlet B *object_b; I want to be able to link this IBOutlet to the view controller, so that I can use it to call functions of class B to display things on the view controller. However, I'm not able to do this - trying

IBOutletCollection (UIbutton)

风格不统一 提交于 2019-12-12 02:52:10
问题 in my .h I have IBOutlet NSMutableArray *buttons; @property (nonatomic, retain) IBOutletCollection(UIButton) NSMutableArray *buttons; -(void)play:(UIButton *)theButton; in my .m I have -(void)initButtons{ buttons = [[NSMutableArray alloc] initWithCapacity:1]; UIButton *myBut = [UIButton alloc]; [buttons addObject: myBut]; [[buttons objectAtIndex:0] addtarget:self action@selector(play:) forControlEventTouchUpInside]; } ... -(void)dealloc{ [buttons dealloc]; [super deallloc]; } ..... -(void

Change width to a IBOutlet (UIImageView)

我们两清 提交于 2019-12-12 02:46:36
问题 I was doing some experiments with Xcode an a little question comes to my mind: that is how I could change size of an UIImage created by storyboard. below the code I used: @IBOutlet var label: UILabel! @IBOutlet var img: UIImageView!//x=0, y=0, w=50, h=50, red, created in the storyboard var numero = 11 override func viewDidLoad() { super.viewDidLoad() if numero < 10 { label.text = "\(numero)" img.backgroundColor = UIColor.blueColor() } else if numero > 10 { label.text = "\(numero)" img.frame =

IBOutlet declaration place

江枫思渺然 提交于 2019-12-12 02:06:41
问题 After searching on Google about this confusion, I found out that the best place to put an IBOutlet is: @interface GallantViewController : UIViewController @property (nonatomic, weak) IBOutlet UISwitch *switch; @end but from what I say, now the switch variable is visible outside of the GallantViewController . Isn't that odd? I thought that this wrong method: @interface GoofusViewController : UIViewController { IBOutlet UISwitch *_switch } @end was behaving like this, and moving it would fix it

How to adapt or custom the shape of a IBOutlet button as the inner button's image in Swift iOS8

二次信任 提交于 2019-12-12 01:24:41
问题 I have an IBOutlet button dragged from Interface Builder (it's easier to play with it in auto layout ) I rotated it by 45° in code as learned here var transform = CGAffineTransformMakeTranslation(0.5, 0.5) var angle = CGFloat(M_PI / 3.9) // degress rotation 3.9 transform = CGAffineTransformRotate(transform, angle) button.transform = transform button.layer.rasterizationScale = UIScreen.mainScreen().scale button.layer.shouldRasterize = true button.setNeedsDisplay() now, I have diamond, triangle

Access IBOutlet from another class

与世无争的帅哥 提交于 2019-12-11 17:11:14
问题 Hey I have two UIViewControllers . In the first one, there's an UIButton which contains an image. When the user then gets to my second ViewController , there are many buttons, which contain different images. So, when the user presses one button in my VC2, it should set the image from itself to the UIButton on my VC1. I've already implemented the first VC by adding: #import "ViewController1.h" to the ViewController2.m before @interface ViewController2 () How can I do that? For example: VC2: -

IBOutlet is not initialized

纵饮孤独 提交于 2019-12-11 14:09:18
问题 there is something strange with xcode. Suddenly the ordinary flow is broken. To check it I've created a new project with just two viewControllers. First (named ViewController) contains only one button to open the second (named NewViewController) controller, which contains the only UILabel. import UIKit class ViewController: UIViewController { override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "Show New View" { guard let newVC = segue.destination as?

XIB-instantiated Object's IBOutlet is nil

我怕爱的太早我们不能终老 提交于 2019-12-11 11:53:22
问题 I have a XIB set up like in this screenshot: alt text http://emberapp.com/jxpx777/images/interface-builder/sizes/m.png File's owner is my main window controller. The XIB is also in charge of creating an object that serves as the delegate for the MGScopeBar view. As you can see in the screenshot, the scope bar delegate has an IBOutlet for the search field so that it can return it as an extra view as part of the delegate process. The problem I'm having is that when the delegate object is