subview

Move Button & View when Keyboard Appears in Swift

五迷三道 提交于 2020-01-05 05:46:17
问题 I am trying to move a button that is initially at the bottom of the view, but when a text field is selected and the keyboard rendered, move the button up with it. If you have used the app Robinhood, its the same functionality when signing in or signing up. Several other posts have not been able to solve this for me. Move view with keyboard using Swift Is there an external repo or solution that has already solved this feature? 回答1: First of write the below code into the ui view extension.

How to prevent subview from overlapping tab bar?

不羁岁月 提交于 2020-01-03 17:10:27
问题 I have a view with tab bar at the bottom. This view is pushed on a navigation controller, so there is also a navigation bar at the top. Unto this view, I would like to show a table view, which I create from its own nib. When I add this view as a subview, it overlaps the tab bar. Is there a way to make this subview automatically resize to the free space in between the top and bottom bar? If not, what is the 'right' way of adjusting its size to fit? -Vegar 回答1: In the interface builder make

Gestures to subviews & MKMapView in iOS - basic iOS

偶尔善良 提交于 2020-01-03 04:49:08
问题 I have a following setup: mainViewController OverlayView - UIView mapView - MKMapView My OverlayView is shown over mapView and responds to UIPanGestureRecognizer Now because OverlayView is above MapView, I can't get the pinch to zoom functionality of MapView to work.. What do I have to do to get mapView to react to pinch and OverLayView to react to Pan (as it does now)? The solution I have now is just implementing the pinch2zoom functionality in the mainViewController so that it scales

remove subview of uiwindow?

人盡茶涼 提交于 2020-01-02 05:18:11
问题 i want to remove a view from uiwindow,so i nslog in appdelegate method,it says window's subviews count as two NSLog(@" %d",[[self.window subviews] count]); so how can i remove that subviews from window,if i remove that subviews i have tab bar controller to be continued... - (void) GetUserCompleted { NSLog(@" %@",[[self.window subviews] objectAtIndex:0]); NSLog(@" %@",[[self.window subviews] objectAtIndex:1]); } 回答1: You can remove the a single subview using the following code. [subview_Name

Passing data between views in ONE ViewController in Swift

感情迁移 提交于 2019-12-30 11:31:54
问题 All of the searches I've done focus on passing data between view controllers. That's not really what I'm trying to do. I have a ViewController that has multiple Views in it. The ViewController has a slider which works fine: var throttleSetting = Float() @IBAction func changeThrottleSetting(sender: UISlider) { throttleSetting = sender.value } Then, in one of the Views contained in that same ViewController, I have a basic line that (for now) sets an initial value which is used later in the

Passing data between views in ONE ViewController in Swift

删除回忆录丶 提交于 2019-12-30 11:31:50
问题 All of the searches I've done focus on passing data between view controllers. That's not really what I'm trying to do. I have a ViewController that has multiple Views in it. The ViewController has a slider which works fine: var throttleSetting = Float() @IBAction func changeThrottleSetting(sender: UISlider) { throttleSetting = sender.value } Then, in one of the Views contained in that same ViewController, I have a basic line that (for now) sets an initial value which is used later in the

iOS - adding/removing a subview programmatically

余生颓废 提交于 2019-12-30 02:09:09
问题 Ok I want to add a UIImageView as a subview and then remove it after a couple of seconds in the way a splash screen works. I found three different approaches to do it but I can not understand which one is the best approach according to Objective-C and Apple. Below are the three different approaches: 1) In my MyAppDelegate.h @interface MyAppDelegate : NSObject <UIApplicationDelegate> { MyViewController *myViewController; UIImageView *myImageView; } @property (nonatomic, retain) IBOutlet

Performance of UIView: removeFromSuperview VS hide

被刻印的时光 ゝ 提交于 2019-12-30 00:52:08
问题 This question is really basic. What is the performance difference between removing a UIView from the view hierarchy and hiding a UIView ? I have read that Views that are not needed should be removed from the view hierarchy. I currently have the situation that a UIButton should sometimes be visible. When do I hide the UIButton and when do I remove it from it's superview? Is it expensive to change the view hierarchy? 回答1: If you need to alternate between showing and hiding the subview, the best

Removing and re-adding a subview with autolayout

血红的双手。 提交于 2019-12-30 00:38:33
问题 When using autolayout, my understanding is that removing a subview ( while holding a reference to it of course), the removed subview still knows its autolayout constraints. However, when adding it back to the super view later, the subview no longer knows its frame size. Rather it seems to get a zero frame. I assumed that autolayout would auto size it to meet the constraints. Is that not the case? I thought auto layout meant don't mess with frame rects. Do I still need to set the initial frame

Make subview rotate too when device is rotated iPhone/iPad

末鹿安然 提交于 2019-12-29 07:05:45
问题 Let me explain what I mean when I say that I want to rotate my subview too. I placed a lot of images to make my self clear. This may look like to much but it is not. Just wanted to be clear. In the nib file that I am currently working on, I have a UIView and button. The UIView that I created in interface builder is connected with the IBOutlet named ViewMain: and the button executes the following method: and what that method does is that it places the view from another nib file in the UIView