Is it possible to call an IBAction UIButton from another view? [closed] - ios

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm new to swift and programming in general. I'm working on an app I didn't write, and am struggling to understand the existing code. To avoid dealing with protocol errors, I want to know if it's possible to reuse the functionality of a UIButtons IBAction on one view and call it's IBAction function in another view. If so How would I go about doing this. Your help is appreciated!
ContextScreen
https://controlc.com/1a91efca
(the button I'm trying to reuse)ContextMenuScreenViewController [a https://controlc.com/90847f01
the original location of the buttonOrderCreateViewController [a https://:controlc.com/3b52eefc
the original location of the refer order button(OrderCreateViewController)
ContextMenuScreenController: where I'd like to reuse the refer order button

Yoy can easily move the logic from IBAction to som function and call this function in IBAction and from any View what you need!

Related

How to animate the expansion of a UICollectionViewCell's content upon selection? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to reproduce into my own app the animation that occurs when you select a cell in the App Store's Today section. Here's how it looks:
The difficulty here is that the views that make the content of the cell seems to be moving from the cell to another UIViewController (detail) while being animated in the process. I guess it has something to do with custom segue animators.
How would you write this animator object, and what are the needed steps to perform on the collection view cell and the detail view controller? (using only UIKit and CoreAnimation)
Thank you in advance. 🙂
There is an elegant transition library for iOS like app store animation named HERO.
Please check following link.
https://github.com/HeroTransitions/Hero

Is it possible to perform 2 different segues on the click of 1 button? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have one UIButton inside a ViewController, and I want when I click on the button, according to a custom condition, to show 2 different ViewController. Is that even possible to have 2 segues in one UIButton?
I'm trying to add 2 segues; however, whenever I try to add one the other one is automatically removed.
First, go drag segue from your initial view to another view, and give an identifier for that connection. Then just use code below, with different identifier names you declare at first. Like "segueToView1" to first view and "segueToView2" to another. And remember to use if else to know which view you are going
performSegue(withIdentifier: "identifierName", sender: self)

Indicate if view dissapearing [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to determine if view is dissapearing without additional BOOL field and setting it's value to YES/NO in -viewWillDissapear -viewDidDissapear?
I am trying to determine if view is not dissapearing casued by "back" button (pop to previous controller). Right now I have isNavigationInProgress property that do this for me.
Not sure I understand your question correctly.
However it looks like you are talking about isMovingFromParentViewController, isMovingToParentViewController, isBeingPresented, isBeingPresented and isBeingDismissed properties
These properties allows you to get the cause of -viewWillDissapear and -viewDidDissapear calls.
See more info on Apple site, UIViewController reference

UIView - allocate vs hide [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a custom view on my ViewController. I want to remove it when I tap on the screen. It contains image and text.
What is the best way to do this?
I know 2 ways:
use hidden on tap on the screen throughout touchesBegan: and allocate it once.
use removeFromSuperview and allocate it every time.
This depends on requirement :
If on an average, user will tap more times again and again, you should got for hidden approach
But if user has to tap a few times, better to go with second approach
Removing a view from it's superview doesn't necessarily mean that the view will be deallocated. If you keep a strong reference to the view you can add it and remove it as a superview without it being deallocated.

Creating my custom UISwitch [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i am looking for a solution to customize a UISwitch
the desigred looks lie this :
how would you managed it?
Here is a tutorial which can help you to create custom UISwitch. It mention to ways to create custom UISwitch. Concept is to subclass UISwitch class and add custom things in it.
You can use a UIbutton and toggle its image for On/Off.
Or else if you want to make animation to toggle On/Off you should use your custom view. Please see this answer

Resources