Button won't work in container view - ios

I have a container view, and in the window it created I added a button. The button is visible, but when I click it there's no clicking animation.
Furthermore, I created an action using it, but it doesn't call it at all.
Here are some screen shots.

check if you perform any long task in main thread
check if the container view and the button userInteraction property is true and Enabled is true
select the viewcontroller from storyboard and make sure custom class ProductsView is assigned to it

Related

how to inactivate segue in Swift

Hi guys i made an app and what i want to do is
when you click "select" button in navigation bar item, i want to make it to click multiple items and the code for that is just to enable collectionView.allowsMultipleSelection = true which works.
click to view an app image
but at the same time i want to make if the user didn't click the select button but the item, i want to show next view controller.
so now, whenever i clicked the image, it directly shows the next view controller since i connected them in storyboard. i want to inactivate it when the "select" button is clicked.
how? do i have to use the prepare func? and not use the storyboard? please tell me the simplest way to do it
thanks
One simple way of solving this:
Connect the entire view controller that contains the images with the other view controller through a segue.
Add an identifier to this segue, which you will use later.
Create a function that segues to that view controller when an image is pressed. - Up to here is just another way of implementing the code that you have implemented
Create a boolean variable, which is set to false when the select button is on ( and the opposite )
Add an if check to your function in number 3. that only segues when the boolean variable is true.
This ensures that if the select button is pressed, you don't segue when images are clicked.

Custom UIView with nib file in Xcode 9

After updating xCode to 9 version, I noticed the following problem:
I have custom UIView with cart, which work fine until update. I use this UIView in top navigation item
This view consist of button and label. And when pressed button, open another view controller
Then, when I compile app, no action when click button. nothing is happened (no entered to button function).
In View debugger all looks good: user interaction is On end button is on top layer
For test I create UIView in simple viewContoller with the same class name and it work. Button open another view controller.
What could be the problem that it stopped working in navigation item?

Unable to add subview in main view on button click

in my project, there are UIView and it have two buttons
i just want to add subview on main view on the click of second button
i am new in iOS so any one help me please
on first Button Click Event just add secondView.hidden=Yes;
and more over create the global instance of the secondView

Segue is not working in storyboard after creating navigation bar

Hi I created a single view project and i put a button in the scene that I embed in navigation bar with a bar button on the right to this scene and then I created the second screen which contain an image view, Then I dragged bar button to second scene using Crtl+Drag and choose show action for segue. which works fine.
Problem : Then I created third scene with some image view in it and I dragged the button from first scene with Crtl+Drag to the third scene and choose "show" for segue action.
but when I run the app only navigation bar segue works and the button do nothing.
UPDATE :
I found why this problem occurs, it's because of stack view constrains. when i put a button or image view in stack view and give it constrain it won't work. but why ?
any suggestion?
As per the discussion, your first problems were solved by setting UserInteractionEnabled to true on the UIImageView, and as for the buttons, it seems they were set up incorrectly the first time.

iOS popover with a close button outside

I need to create below thing
Currently i'm using WYPopover , but I can't create the button since it's outside of the popover. Is there any existing solution out there ? Many thanks
Create a bigger popover UIView holding all your child elements (current popover + button) and make its background transparent or however you wish.
Popover-controller's are exclusively used in iPad. If you want to use in iPhone, you should create it in a custom way.
I am not familiar with the XYPopover in Github, but normally the custom created popover should be dismissed whenever the user taps any place in the screen. That is one of the key feature of the popovers.
Normally the custom popovers are build like, adding a hidden parent view and then the visible image of a popover frame on it.
You should to do the following,
Avoid dismissing the parent view on tap of parent-hidden-view.
Add a close button at the area where you want to show the close button, on top of the parent-hidden-view.
Capture the button click and dismiss the view (remove the view from superview)
How to customize your need
Creating custom popover view is not a big task. It will take maxim one day, try it your self.
One Parent view with clear color
One background image of a popover frame.
View-inside popover (this needs to be customized for UIPopover also).
Close button.

Resources