I have a situation where I have one container like contentContainer and the second container mainContainer. I want to make the second container scrollable and the first container as non scrollable.
try referencing the inside container:
trace( Maincontainer.insidecontainer);
also if its a component you set the scrollable property to false, if you dont understand me or need help let us no i will make you a sample file to explain...
Related
I have a view controller with this layout (note that yellow and table views are siblings):
I want the yellow view to act as a container, so I'm doing this in viewDidLoad:
yellowView.isAccessibilityElement = true
view.accessibilityElements = [yellowView!, tableView!]
When in Voice Over, I select "Containers" from the accessibility rotor and expect to be able to swipe up and down to move from the yellow view to the table view and back again:
Yellow (swipe down) β TableView (swipe down) β Tabbar (swipe up) β tableView (swipe up) β Yellow
However, this is not the case - after the tableView gains focus, swiping up does not move focus to the yellow view, it just stops there. Swiping down, moves to the tabbar - it seems that my custom view is ignored as container.
I have experimented with many combinations of adding superviews and setting isAccessibilityElement = false to them, but nothing seems to work.
Does anybody know how to solve this?
it seems that my custom view is ignored as container.
Apparently, only native elements may be recognized as containers for the rotor.π€¨
I tried by creating an UIAccessibilityElement inside a view defined as its container with an accessibilityContainerType but no results.π€―
I never use the rotor with the container item but this issue has aroused my curiosity. π€
I looked into this problem and found out an interesting answer that highlights the same a11y trait value for all the native containers... those that are analyzed by VoiceOver as such at least.
Override the trait value of your specific containers as follows for instance:
override var accessibilityTraits: UIAccessibilityTraits {
get { return UIAccessibilityTraits(rawValue: 0x200000000000) }
set { }
}
This is a workaround because nothing else seems to be done for custom containers but I'm not a big fan of using raw values that may change or may not be used in a future release.
Anyway, following this rationale, you can now setup accessibility containers so that gestures work properly with the VoiceOver rotor. π
Did you set an accessibilityLabel on the yellowView or try changing the accessibilityContainerType = .semantic?
I think VoiceOver is not finding yellowView because the rotor is looking for UIAccessibilityContainer but the default container type is .none for UIView. However, a UITableView has a default container type of .semantic.
I'm not entirely new to iOS/Swift development but I've mostly been working on "backend" code so my UI design/development skill level is unfortunately not what I'd like it to be. With that in mind, I have a UI layout (for a view controller) that looks something like this:
In this layout, the view labeled "View To Swap" could be in one of three states:
It may be hidden (or removed?) in which case StackView B should appear directly below StackView A
It may need to show (or be replaced by?) "Subview A"
It may need to show (or be replaced by?) "Subview B"
Both Subview A and B will have a button in the upper right hand corner that, when clicked, should remove/hide the "View To Swap" view.
I've been reading about container views a little bit and I'm wondering if this is the approach that I should take here or is there a more simple, direct way to implement this? I'm currently using the storyboard and autolayout to define my primary view (the view on the left) and constraints but I understand the basics of building a UI programatically if that makes it easier to implement something like this? Thanks for any suggestions!
You need to insert the 3 main views ( top stack , viewToSwap , bottom stack ) inside a vertical UIStackView with distribution = fillEqually , and hook viewToSwap as IBOutlet, whenever you want to hide it do
self.viewToSwap.isHidden = true
this will automatically collapse it's content , and you can add any subview to it (A/B) and don't forget self.viewToSwap.clipsToBounds = true
I'm using PureLayout in my iOS app and I'm following the instructions here:
https://github.com/PureLayout/PureLayout/wiki/Tips-and-Tricks
That is, using a flag called didSetupConstraints and the method updateViewConstraints.
But now I would like to add a view inside another random view when user presses a button.
The only way to do that I could imagine was creating another flag like didNewViewSetupConstraints and creating another block inside updateViewConstraints, where I use 2 UIView variables to create the new constraints between them.
Is that right? Because I think it is a lot of work for just a small thing (adding a subview and its contraints).
Note that I cannot create the constraints without installing them because I donΒ΄t know the beforehand (the user will tap them). That is the reason I remark RANDOM.
I see in sample code number 10, it is used autoRemoveConstraints and autoInstallConstraints to toggle between 2 groups of constraints. Because my 2 views are random, I guess I cannot do something like that, that is the reason I created a flag and 2 variables for these 2 views to setup the constraints inside updateViewConstraints. But I'm sure that is too much.
Thanks for any suggestion or idea.
You don't have to create/activate all of your constraints inside of -updateConstraints. You can create constraints at any time, and activate them as long as both of the views you wish to constrain share a common superview (in other words, the views need to have been added to the same view hierarchy already).
I would recommend creating your default set of static constraints inside of -updateConstraints as you're doing. Then, in the callback method when the user taps the button, you can create this new view, add it as a subview, and then create & activate the new constraints for it right then and there.
If you remove this view later on, that will remove all of the constraints associated with it automatically. But if you need to adjust the constraints for this new view, you can store a separate reference to the constraints when they are created.
I've tried to study the visual objects in XCode but I dont understand which of them fits my need. What I need is something that corresponds to what in html is a DIV or any other html-element that can be used as a "container". Here is the description of my problem:
I need to display 3 container/areas in my app.
In each container I will put an unknown number of buttons. Its about dynamically created buttons.
In html I would have 3 DIVs. And then add/remove buttons from this divs when needed.
How can you do the same thing in Objective-C? I have read about drawRect or stuff like that. But is that the only/best way to do it? Isn't there an IU object that can be used for this?
Normally, the "container" would be the UIView. You can attach views to other views with:
[view1 addSubview: view2];
view2's frame will determine where it is located within view1. Since buttons and other objects are UIViews, as well, they are added as subviews.
It's a UIVIew but you shouldn't use it the same way you use a DIV.
It's absolutely essential that you understand the iOS interface paradigm. Please, do yourself a favor and read the HIG: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/index.html
While i am translating button one position to another position, the animation add within container only. Actually i need to translate the Button some inner container xy points to parent container xz points. This is my code.
tileAnimation[count]=ParallelAnimation::create(mPlayField[count])
.add(TranslateTransition::create().toY(1200).duration(3000))
.add(FadeTransition::create().to(0).duration(3000));
How can i do this? Its working fine in single container. If my design has container within container its making problem.
I do not believe you can translate an object out of its parent (at least that does not make any sense to me). What you should do is have the button you want to move in the outer Container position so that is overlays the inner Container, then translate it to the location you want in the outer container.