UIView - allocate vs hide [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 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.

Related

Is it possible to call an IBAction UIButton from another view? [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 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!

Change the structure automatically? (iOS/Storyboard) [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 4 years ago.
Improve this question
To know better what I mean, check this screenshot here. Let's say the UIView with the number 3 are removed. Is it possible to tell the storyboard or ViewController it should after the remove put the UIView number 4 and 5 higher (the y-position), so that it looks like this screenshot?
Sorry for the very basic question, but I have no idea how I could start or if this have a special name, to google it.
This job is best fit for a vertical UIStackView , as setting
self.view3.isHidden = true
will automatically collapse the view , but if the items count will be many than fit in a single device height , then you have to embed the stackView inside a UIScrollView , or use a UITableView instead

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

How to set stack background colour? [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 am working for iOS app using swift in XCode.
I need four clickable image views at bottom of the view. I have adjusted those in stack. Now I want to give a background colour to whole stack. Is there any option for this?
Thank you for help :)
You can't do this – UIStackView is a non-drawing view, meaning that drawRect() is never called. Its background color is not set. You can place the stack view inside another UIView and set background color value of that view.

Tricky transition in custom view [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
Good day everyone!
A customer asked me to implement a view. Here you can download and look at video how this view should work. (Left cells are days, right - hours)
It's kind of calendar view.
I've tried to do this task with collection view and custom layout. But do not hit much success. Because of the tricky transition of left cells. They become smaller (to speed up scroll), but right side is still the same.
Is there any possibilities to create such transition in collection view or picker view? Or should i use base view with overriding draw method?
Regards, Eugene.
It's a calendar, so it's essentially infinite, so I don't think a UICollectionView or UITableView is appropriate for this (e.g. what would you return as the number of cells?).
I'd be creating custom UIView subclasses for the left and right side, and overriding drawRect.

Resources