uiview

Adding UIViewController.view to another view causes orientation problems

浪子不回头ぞ 提交于 2020-01-25 08:31:05
问题 Short version: I'm alloc/init/retaining a new UIViewController in one UIViewControllers viewDidLoad method, adding the new View to self.view. This usually works, but it seems to mess up orientation change handling of my iPad app. Longer version : I'm building a fairly complex iPad application, involving a lot of views and viewcontrollers. After running into some difficulties adjusting to the device orientation, I made a simple XCode project to figure out what the problem is. Firstly, I have

Solid solution to flexibly resize UIView based on subviews

这一生的挚爱 提交于 2020-01-25 04:53:05
问题 Imagine you have four or so views, all width 100, different heights. You have a wrapper view W which holds them all. A | B | W C | D | the heights of the small views can change. At that time you want them all to move, float, appropriately, and resize W. Now, I was just about to write a few lines of code to do this. So .. (1) you'd have W find all the subviews and list them in order from top to bottom. Then (2) each time there is a change, you'd (3) reposition each of ABCD. the position of

ImageView changes frame/bounds

耗尽温柔 提交于 2020-01-25 03:05:35
问题 I have been trying to find this issue here, but no topic seems to fit... I have a UINavigationController that pushes different kinds of UIViews containing images. When the controller pushes a new view, it the navigation bar is moved onto the screen and it appears that the image subsequently is being 'squelched' a bit - or it 'moves in from top' (I hope I described this sufficiently). Anyway, my image has the frame of 320x460 (because of the top bar). I couldnt find a proper setting, where the

ImageView changes frame/bounds

大兔子大兔子 提交于 2020-01-25 03:05:07
问题 I have been trying to find this issue here, but no topic seems to fit... I have a UINavigationController that pushes different kinds of UIViews containing images. When the controller pushes a new view, it the navigation bar is moved onto the screen and it appears that the image subsequently is being 'squelched' a bit - or it 'moves in from top' (I hope I described this sufficiently). Anyway, my image has the frame of 320x460 (because of the top bar). I couldnt find a proper setting, where the

How to add a UIPageController and UICollectionViewController to a UIViewController programmatically

試著忘記壹切 提交于 2020-01-24 23:10:28
问题 I already have a UIViewController made programmatically, and would like at the bottom to have a collection view with 4 cells, but I want to be able to swipe through different pages of the collection view to see different cells. I'm not sure where to begin with this wether to enable paging on the collection view and how that would work with setting up the cells, or to create a page controller and adding the collection view to that? There are a couple of ways that I have seen online already,

Increase area of UIButton in UIStackView

时光毁灭记忆、已成空白 提交于 2020-01-24 22:30:08
问题 I have couple of UIButtons embedded in UIStackView. I understand UIStackView takes only the intrinsic size of UIButton when laying it out. But I want to increase height/width of UIButton when inside UIStackView. Without UIStackView, I can easily increase or decrease UIButtons frame size. What is the deal with UIStackView? Detail: Let's say I gave 3 UIButtons with only UIImages and no text. Button 1 is 80x80, button 2 image is 30x30, button 3 image is 30x30. I would like touch area of button 2

Animate UILabel width with fixed center

好久不见. 提交于 2020-01-24 12:46:05
问题 How to animate a change in width while keeping the view centered? Currently when I do it, it doesn't grow from the center. self.textLabel = UILabel() self.textLabel.frame = CGRectMake(0, 0, Globals.voterTextLabel, Globals.voterTextLabel) self.textLabel.center = CGPointMake(self.view.frame.width/2, self.view.frame.height/2) self.textLabel.text = "VS" self.textLabel.layer.cornerRadius = Globals.voterTextLabel/2 self.textLabel.layer.masksToBounds = true self.textLabel.clipsToBounds = true self

IQKeyboardManager is not working in subviews

此生再无相见时 提交于 2020-01-24 06:27:15
问题 I have three UIView s in a single UIViewController . Each UIView contains a UITextField . But IQKeyboardManager is not showing next and previous arrows as every textfield is in a different view. Is there any solution for this? 回答1: You can make UITextFields/UITextViews container view as IQPreviousNextView. It is designed to handle the situation you are facing. You can find it's demo on repository demo project. 来源: https://stackoverflow.com/questions/37391882/iqkeyboardmanager-is-not-working

IQKeyboardManager is not working in subviews

…衆ロ難τιáo~ 提交于 2020-01-24 06:23:34
问题 I have three UIView s in a single UIViewController . Each UIView contains a UITextField . But IQKeyboardManager is not showing next and previous arrows as every textfield is in a different view. Is there any solution for this? 回答1: You can make UITextFields/UITextViews container view as IQPreviousNextView. It is designed to handle the situation you are facing. You can find it's demo on repository demo project. 来源: https://stackoverflow.com/questions/37391882/iqkeyboardmanager-is-not-working

Why is drawRect leaving parts of image?

ぐ巨炮叔叔 提交于 2020-01-23 12:59:08
问题 Here's my case: I have a table which contains a list of restaurants, each entry shows the results of inspections over time on a scorebar that is drawn using drawRect. When the user scrolls the table down and then up, so that scorebars with yellow and red squares are shown, previous scorebars pick up those squares. Dates are also drawn into previous scorebars. My problem lies in getting rid if the old squares. Shouldn't they be erased each time drawRect is called? I've placed three images