I have created a Storyboard through Expression Blend. The Storyboard animates an Ellipse as a sortof placeholder for now. Now that I am back in Visual Studio, how can I make the Storyboard do the exact same thing but to a different control? I have a list of images:
private List<Image> items = new List<Image>();
Each object in items has been assigned with a name using the Name property:
items[i].Name = i.ToString();
'i' in this case is the counter.
How do I therefore make the Storyboard target "one" specific object within the list for the moment. Later, I shall try to make the Storyboard do the same for all of them.
Any help is highly appreciated.
I fixed the problem by having a Storyboard Completed event and changing the target using:
Storyboard.SetTargetName();
Related
Here is the scenario/dilemma I'm currently in.
I have a UIImageView that contains a placeholder Image.
myImageView = new MvxImageView
{
Image = ImagePlaceHolder
};
I bind a MvxImageViewLoader from the View to a string property(URL)in the ViewModel.
imageLoader = new MvxImageViewLoader(() => myImageView);
All of this works just fine and properly displays the image when a valid URL is present.
The issue is this, Say the bound URL/imageLoader does not contain a string.
Instead of defaulting back to the placeholder image, I would like to display a UILabel in Place of the Image View.
Whereby this UILabel, will also be bound to some text.
....
Now that I think about it, I believe a possible solution would be to create a boolean property on the ViewModel and have its status update depending on the value of the URL i.e
string.IsNullOrWhiteSpace(URL).
Then I could have the UILabel's.Hidden property bounded to this boolean property in the ViewModel to determine whether or not to show or hide the Label.
Not sure If I should delete this or let it be... it may be helpful to someone in the future.
.. I guess sometimes its best to talk it out... even if you're typing it out.
I'm trying to update my app for the new iPhone X. After reading about the safe area feature and the check box "Safe Area Relative Margins" in each UIObject's "Size Inspector" (ruler tab), I didn't think this would be too bad. However, that feature does not seem to be working for me.
Nothing changed for regular iPhones, which is good, however for the X, the top of my app overlaps the top inset of the phone by a third. Is there any known way to fix this* or something I'm missing?
*By fix this, I mean make it so that my objects start below the outcrop, like the second picture.
What is happening:
Desired Behavior (from https://arstechnica.com/gadgets/2017/11/how-devs-updated-their-apps-for-the-iphone-xs-screen-and-the-notch/):
I too have wasted hours on this. And while I cannot answer your question of why this is broken in Xcode, I can provide a solution.
But first let me note than in Xcode 11.3.1, I experience the same issue in a new project created from scratch.
Set up your storyboard:
On your storyboard, select "Use Safe Area Layout Guides". This will add a safe area to each of your ViewControllers. It will also require you to target iOS9+. You might be able to skip this step though (see step 4 below).
View your storyboard as iPhone 4s.
Fix each ViewController:
Select all views under the top-level view.
Click Editor | Embed In | View Without Inset. This creates a new view and puts all your views inside.
Make this new view expand to the safe area by adding safe area constraints (by control-dragging your new view onto the top level view).
Leading space to safe area
Top space to safe area
Trailing space to safe area
Bottom space to safe area
If you did not opt into using a safe area storyboard above, you may be able to create four equivalent constraints by using the Top Layout Guide, Bottom Layout Guide, and the left/right sides of the top-level view. This may not work in landscape though. And I did not test this.
Set your new view as transparent.
Give your new view a name like "SafeAreaView".
In iOS 11, margins are inset from the safe area. Thus, your zero top margin becomes a 20 top margin — explaining your screen shot. If that's not what you want, set the view's insetsLayoutMarginsFromSafeArea property to false.
In my case modalPresentationStyle = .fullScreen has to be set to the view controller being presented
I would like to point out that I am aware of this question: How to copy or duplicate a ViewController in Interface Builder?
and that I followed its instructions.
When I do copy/paste said ViewController, the new "pasted" one is smaller than the original.
The two ViewControllers: One bigger and the other smaller
Another discrepancy between the two is that I can't seem to select the "pasted" ViewController's Navigation Bar to change its title.
What shows up in the Utilities area when I select the Pasted's nav bar instead of the "Title", "Prompt" and "Back Button" I get when I select the original's nav bar: Pasted's nav Bar.
Is there any way to get it to be the same size as it's counterpart and/or let me select it's Navigation Bar so that I can change its title?
Sorry if the question is a bit strange but bear with me please...
So there are two separate issues:
When you copy/pasted that VC, it no longer inherited from a segue its estimated size, so if you had for whatever reason a different size specified for the view it segued from, that is the size for the old VC, but the new one just gets the default size. If this is indeed the case, you can always change the size of the new VC by under Size Inspector, choosing Freeform and specifying it.
To get the navigation bar back, drag a Navigation Item from the Storyboard Object library onto your new VC and you can re-title it (and delete that button you added).
I am just learning Xcode. I did something that caused a view controller to turn black below the navigation bar when you build app.
It looks white in storyboard.
Also, when I pull a label onto the storyboard, it aligns to the left margin and does not show the drag boxes around it.
I may have inadvertently clicked something but when I compared it in attributes and identity inspectors line by line to another project, nothing seems amiss, i.e. everything is the default value.
Has anyone run across this?
There is not code in associated class that would cause this as it is generic i.e. plain vanilla.
Would appreciate any suggestions. Thx.
With that little information i'd say you removed the root view of the controller?
Either way, you say there is no code, so I'd suggest you simply delete that controller and create another one (bottom right, objects, viewcontroller). Since it's empty you're not gonna lose any data or time :)
Then link it to your class in the Identity Inspector and you're good to go as if it was a new one.
I have a reasonably complicated UIView which contains several nested views which are displayed according to a variety of responses - all are laid out in a storyboard.
Is there a way to hide a view in the foreground to work on a view in the background? As its really fiddly selecting particular elements to arrange / style!?
I've been trying to figure out a nice way to do this, some function like hiding the view and its subviews from the storyboard (not from the actual application), but couldn't find anything.
This is not the nicest of ways but it is how I do it at the moment...
What I do is select the views I want to "hide" from the document outline and add a constant (screen width/height) value to its x/y origin value to push them out of the screen. I also change the document label for those views (Identity Inspector > Document > Label) to something like "Hidden" so I can later search for the "hidden" views from the document outline and put them back where they belong.
I have 2 work arounds.
A) Change the View Controllers size to freeform. Set its size to be really large so I can space out the views.
B) Use the sort order of the views Document Outline (lowest is front most) and add an image view (same as the view background) under the first view to block the others. Then delete it after finishing my edits.
or xcode developers could just simple add a design-visible checkbox for views and controls.... but ill take my rants somewhere else.
In xcode 7 you can do it from the storybord
for more details
https://stackoverflow.com/a/25213491/4879683
Maybe this could help you :
Open your storyboard in the Finder and edit it with a simple text editor (not xcode).
You will see it's just a xml file.Look for the view you want to hide, and add hidden="YES" in the parameters list.
That's what I do on my own project.
In Xcode when you select your storyboard, you have a panel that displays all your view controllers and their hierarchy. If you change the order of the elements you change the background/foreground order.
You can add extra views to the scene dock.
These views get initiated along with the view controller, but are not added to the view controller's view hierarchy. You can reference them using IBOutlets.
e.g. I have a full screen loading view that I added to the scene dock instead of covering up the view controller in the storyboard. I can add the loading view to the view controller's view hierarchy in code:
#IBOutlet weak var loadingView: UIView!
...
loadingView.frame = view.bounds
loadingView.autoresizingMask = UIViewAutoresizing.FlexibleWidth.union(UIViewAutoresizing.FlexibleHeight)
view.addSubview(loadingView)
Reference: https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/Chapters/AddViewsToDock.html