Questions tagged [layoutsubviews]

layoutSubviews is a method that is called automatically during view size changes. It can be used by a custom view to perform additional manual changes above and beyond any autoresizing behaviours

This method is called automatically and should not be called directly. UIKit will call it automatically whenever a view size changes. This could be as a result of resizing due to orientation changes. For example when the user rotates the iOS device to portrait or landscape mode.

In the custom view that implementslayoutSubviews, any view changes in addition to the autoresizing behaviours should be applied.

For further information please refer to the View Programming Guide for iOS. See the section on "Tweaking the Layout of Your Views Manually".

See also the UIView Class Reference.

149 questions
0
votes
1 answer

Resizing properties in custom cell for UITableView

I have a UITableView with a custom cell and its corresponding .xib. My CustomCell.h has 3 properties. I want to be able to specify the width of these properties programmatically without using auto layout. The three properties are a background image,…
WillJ
  • 1
  • 1
0
votes
1 answer

Dynamic UILabel which has custom width does not apply while scrolling in UITableView with AutoLayout

I am having a problem with AutoLayout and layoutSubviews I am using iOS9 SDK Beta One of my dynamic content label has colored background so I need to add custom width for spacing. Screenshot 1 (Looks Ok On View First Load) Screenshot 2 (Problem…
ayalcin
  • 877
  • 1
  • 8
  • 16
0
votes
1 answer

Can a value of a var in @IBDesignable depend on external values, such as a frame of a view?

I want to draw a shape hole in an @IBDesignable view. For this I need the size of a view, which is above in the view hierarchy. This view changes it's size by constraints. How to retrieve the frame? May this is not possible at all, because the view…
wider-spider
  • 465
  • 4
  • 12
0
votes
0 answers

layoutsubviews not called when iPhone rotated upsidedown at one time

I'm making a function using Camera(AVCapture input/output). Now I have a trouble like below. 'layoutSubviews' is not called when iPhone is rotated upsidedown(180 degree) at one time. (If rotate in 2 step 90 degree and 90 degree, 'layoutSubviews'…
M.Masa
  • 532
  • 4
  • 20
0
votes
0 answers

Change UITableViewCell Frame in layoutSubviews iOS 8

i am trying to get similar effect of the UITableViewCell in iOS FaceBook App so i subclassed a UITableViewCell and in the layoutSubviews i use this code to resize the cell frame self.frame = CGRectInset(self.frame, 1.5, 1.5) and for the rounded…
Amr Mohamed
  • 2,290
  • 4
  • 20
  • 39
0
votes
1 answer

Odd enum memory issue in layoutSubviews

In the layoutSubviews of uitableviewcell, there is logics like switch(enum_instance){ } enum_instance was changed from some place, for instance in one timer, then setNeedLayout to trigger layoutSubviews But the enum_instance in layoutSubviews will…
Forrest
  • 122,703
  • 20
  • 73
  • 107
0
votes
1 answer

Scaling a view and all its contents

I'm wondering if there's a way to scale a UIView and all it's subviews. When I say scaling, I'm not just talking about the frames, I wan't to scale everything so the fonts too. At the moment I'm doing it manually : -(void)setScale:(float)scale { …
batsansierra
  • 315
  • 1
  • 12
0
votes
1 answer

Custom UIView in storyboard not showing subviews

I have created a custom UIView to show an UIActivityIndicatorView and a message. Idea is to reuse this across my app for consistency. Below is the code: @implementation CDActivityIndicator @synthesize activityIndicator, message; //init method…
0
votes
1 answer

layoutSubviews Confusion — Manipulating TMQuiltView

I'm trying out this custom class — TMQuiltView — https://github.com/1000Memories/TMQuiltView. Normally, I layout interfaces in Storyboard, and that's not an issue. Since this is a custom class, it appears as if I have to do so programatically. I…
schmorgledorf
  • 17
  • 1
  • 7
0
votes
1 answer

The view connected with IBOutlet property in UITableViewCell can not change frame

I have a class A , subclass of UITableViewCell, and just linked its IBOutlet property titleLabel to UILabel in the storyboard. but seems I can not change the frame of titleLabel. - (void)awakeFromNib { [super awakeFromNib]; …
shanegao
  • 3,562
  • 1
  • 18
  • 21
0
votes
1 answer

Swift: layoutSubviews not being called by setNeedsLayout

I have a background which is also a UIView, on which has 3 UIViews as its subviews. I added a UIPanGestureRecognizer to each of them, hoping when the user drags a view to the left, the corresponding UIView expands horizontally. Heres my code: func…
ddolce
  • 739
  • 2
  • 10
  • 30
0
votes
0 answers

willRotateToInterfaceOrientation + setframe can't layout

I'm trying to change the shape of a view right before rotating (without animation but with a CGRect I want to get at that time) and while rotating (with new CGRect). Basically, iOS won't layout anything in the "willRotateToOrientation" method, even…
Heidan34
  • 1
  • 2
0
votes
1 answer

when implementing layoutSubviews in custom UITableViewCell the border of the cell disappear

they say a picture is worth thousand words so... when i dont implement layoutSubviews in custom UITableViewCell i get this after implementing layoutSubviews in custom UITableViewCell i get this How can i get the first picture with the…
liv a
  • 3,232
  • 6
  • 35
  • 76
0
votes
3 answers

How to layout custom UITableViewCell with varying height

I have a UITableViewCell subclass which has an image, title and description. I am supposed to resize the cell height according to the description content length i.e. if it spans more than 5 lines, I should extend it (+other subviews like image etc)…
Nirav Bhatt
  • 6,940
  • 5
  • 45
  • 89
0
votes
2 answers

Why does UIViewController almost always require layoutSubViews?

Before iOS7, I whatever CGRect I define to a UIView's frame, it was working. For example: imageView.frame=CGRectMake(20,20,80,80); was perfectly leaving 20 x 20 margin at the top left of the screen. Interestingly if I add another UIView…
frankish
  • 6,738
  • 9
  • 49
  • 100
1 2 3
9
10