Using An Image View In Xamarin iOS - xamarin

I am trying to setup an image view in my Main.Storyboard so that I can update it in my app extension. I am struggling to work out how to get the code to initialise the Image View. I feel so stupid for not being able to figure this out.
In Xcode, I am used to linking it by dragging the constructor (if that's what it's called) into the app code.
How is this accomplished in Xamarin?
Much thanks.

In the storyboard, select the UIImageView. Then in the properties window (on the right, usually) there is a Name property. That creates an outlet to your view controller class with UIImageView. You can access it in the ViewDidLoad method (that's the earliest it's guaranteed to be initialized) and setup the UIImageView however you need.
See this screenshot showing the Name property:

Related

How to convert manual view controller to storyboard as a launch screen

New iOS requirements need Apps for iPhone or iPad must be built with the iOS 13 SDK or later and use an Xcode storyboard to provide the app’s launch screen.
But my project is very old and has never used Storyboards. All UI elements are created dynamically using ViewControllers.
I managed to create a storyboard file and set it as a launcher but it has no scenes and I do not know how to proceed. I would like to:
Create a scene where I place only the original launch image inside (hoping that apple still accepts this branding)
If it is possible to just connect my main ViewController with the scene (if that works with dynamical ViewControllers)
If nothing helps than I would need to create a simple scene which has just a bottom bar like my ViewController
I had this exact issue, here's what I did:
Create LaunchScreen.storyboard and set to use it as launch screen
Using the + button in the top-right (this was not an obvious step), add a View Controller into the storyboard
Untick "Use Safe Area Layout Guides" on the right panel if you're getting that error
Tick "Is Initial View Controller"
Then clean and run, for me it just worked. I did have trouble seeing it update though, as discussed here: Launch Screen storyboard not displaying image

Xcode UICollectionViewCell xib not displaying any views added to it

I'm trying to create a custom UICollectionViewCell backed by a *.xib file.
However, when I try to add subviews to the cell, interface builder (as well as an actual instance of the cell inside the app) doesn't show them at all.
It doesn't matter whether I add in an UIView as a contentView or not, all subviews seem to be invisible.
This happens in Xcode 7.2 inside a tvOS project. Does anyone experience the same issue or can see what I'm missing?

UICollectionViewCell for AppleTV does not display contents in Interface Builder

When trying to build up a UICollectionViewCell for an AppleTV app, its contents are not displayed, making it more difficult to good design. Does anyone know whether this is a bug or something I'm doing wrong?
The contents do appear when moving, below are 2 screenshots, one of the normal state, and one of the state of moving an element.
I'm using Xcode version 7.1.1 (7B1005)
I tried and it looks like the cell will only be rendered, if you embed it in a collection view which is embedded in the main view. Additionally you have to add some auto layout constraints:

In Xcode, how do I create an outlet for a button that is inside a container?

I'm a total newbie with xcode and swift, trying to wrap my head around ios programming.
I'm designing a storyboard for my app. The storyboard uses containers to keep track of the controls. In one of the containers resides a button. I want to create an outlet for it to add some code when it is clicked.
If the button would be on the base viewport of the storyboard, I would control-drag a blue line from the button to the source window with my UIViewController subclass file, and it would assist me in generating the code. But for some reason when the button is in a container, this just doesn't work.
When following the documentation, it says to open the assistant editor when the button is selected and it should open the relevant file. So it open an objective-c file, but when I try to control-drag into it, it informs me that I do not have write permissions. Also I feel like I should be doing it in a subclass instead.
I have searched online a lot and tried everything I can think about, but nothing has worked so far. How does this work? Can I do it programmatically or so perhaps? I hope someone can straighten out this question mark...
A container view is intended to represent an area that will host a view from a different view controller that becomes a child of the view controller that owns the container. Usually, you would create a second view controller, link your container view to it using an "embed" segue, and then put your buttons and such in the second controller's view. The code behind those would then go into the second controller.
If your purpose is simply to have superviews to control layout within a single view controller, use a UIView rather than a container and the problem goes away. That's what the Editor->Embed In->View menu item is for.

Showing views in interface builder outside viewcontroller hierarchy in xcode5

I often make use of views in interface builder that live outside of the viewcontroller hierarchy (see screen grab below for simple example).
Before upgrading to Xcode5 I could get this view to appear on the storyboard by writing an IBAction outlet and dragging a connection from the code to the view in the storyboard.
If you paused over the button for a moment it would flash and then open up as a view on the storyboard that is then a lot easier to work with.
Since upgrading this function no longer seems available. Has anyone found out how to get these views to appear on the storyboard?
Edit:
Using the temporary viewcontroller as described in this answer seems one approach, although fiddly since you need to move the UIView stack between viewcontrollers each time you want to edit the layout. Using a separate XIB is starting to seem like the sanest approach.
https://stackoverflow.com/a/13713385/1060154
Finally, we get this back in Xcode 7.
Hallelu!

Resources