subview

Autolayout and subviews

戏子无情 提交于 2019-12-18 10:41:07
问题 I am using the iAd suite with storyboards from Apple, as per this link... Apple iAd Storyboard documentation It all works fine until I turn autolayout on. It builds fine but crashes on running. The output I get is: 2013-08-24 12:06:36.138 TabbedBanner[7272:c07] * Assertion failure in -[UIView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIView.m:5781 2013-08-24 12:06:36.139 TabbedBanner[7272:c07] * Terminating app due to uncaught exception 'NSInternalInconsistencyException',

Next/Done button using Swift with textFieldShouldReturn

懵懂的女人 提交于 2019-12-18 10:33:58
问题 I have a MainView that adds a subview (signUpWindow) when a sign up button is pressed. In my signUpWindow subview (SignUpWindowView.swift), I set up each field with a function, as an example: func confirmPasswordText() { confirmPasswordTextField.frame=CGRectMake(50, 210, 410, 50) confirmPasswordTextField.placeholder=("Confirm Password") confirmPasswordTextField.textColor=textFieldFontColor confirmPasswordTextField.secureTextEntry=true confirmPasswordTextField.returnKeyType = .Next

reload/refresh subViews - setNeedsDisplay doesnt work

安稳与你 提交于 2019-12-18 04:23:42
问题 i have trouble with setNeedsDisplay. I have an UIView with a lot of sub UIViews, created in Inteface Builder. I have also an Button with IBAction. In this IBAction i want to redraw/reload all UIViews (or all UIElements, like UILabel, UIWebView and so on..) I am doing this, which doesn't work for me, dont know why.. : //redraw the UIViews [self.view_card_0 setNeedsDisplay]; [self.view_card_1 setNeedsDisplay]; [self.view_card_stapel setNeedsDisplay]; //other UI Elements [self.webView_0

Draw Line with gesture

自作多情 提交于 2019-12-18 01:32:27
问题 I add a view as sub view using the following code imageview = [[UIImageView alloc] initWithFrame:[holderView frame]]; [imageview setImage:cppobject->OutputImage]; imageview.contentMode = UIViewContentModeScaleAspectFit; [holderView addSubview:imageview]; holderView.contentMode = UIViewContentModeScaleAspectFit ; UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scale:)]; [pinchRecognizer setDelegate:self]; [holderView

Difference between addSubview and insertSubview in UIView class

社会主义新天地 提交于 2019-12-17 10:20:13
问题 What is the difference between addSubview and insertSubView methods when a view is added programmatically? 回答1: The only difference is in where the view is added: whether it is the frontmost view ( addSubview: ), or it is before the 5th subview, ( insertSubview:atIndex: ) or if it is immediately behind another subview ( insertSubview:aboveSubview: ). 回答2: Using insertSubView: you can specify the index, which determines z-order of views. A view with a higher index lies above those with lower

Where Does A UIAlertView Live While Not Dismissed

那年仲夏 提交于 2019-12-17 07:29:31
问题 Does anyone know in whose subview an active UIAlertView is located or how to find the thread in which it is running? 回答1: If you dump the contents of the windows property and all subviews of all views you can see that the UIAlertView is in a separate window that overlays the main window. Here I have a navbar with a viewcontroller and a tableview (I removed its subviews since they're not relevent). <UIWindow: 0x411fd50; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <CALayer:

Where Does A UIAlertView Live While Not Dismissed

我只是一个虾纸丫 提交于 2019-12-17 07:28:53
问题 Does anyone know in whose subview an active UIAlertView is located or how to find the thread in which it is running? 回答1: If you dump the contents of the windows property and all subviews of all views you can see that the UIAlertView is in a separate window that overlays the main window. Here I have a navbar with a viewcontroller and a tableview (I removed its subviews since they're not relevent). <UIWindow: 0x411fd50; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <CALayer:

Find subviews within rectangle

时间秒杀一切 提交于 2019-12-13 19:58:05
问题 I have a large UIView with many small subviews . I need to find all subviews within an area. I am currently iterating through subviews and using CGRectContainsPoint . This works, but 90% of the subviews are usually not within my rectangle of interest. Is there a more efficient way to find all subviews within a rectangle? Thanks 回答1: CGRectContainsRect would be more appropriate. You'd still need to loop through all subviews that might be in your rect based on what you can assume about their

Not able to lay out Subviews on a custom UIView in Swift

送分小仙女□ 提交于 2019-12-13 03:33:13
问题 So I have created this custom container view which I am laying out using autolayout constraint. func configureSegmentContainerView() { segmentContainerView.topAnchor.constraint(equalTo: view.topAnchor, constant: 40).isActive = true segmentContainerView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 8).isActive = true segmentContainerView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -8).isActive = true segmentContainerView.heightAnchor.constraint(equalToConstant: 3)

Put a UITextField inside a UITableViewCell's AccessoryView

ⅰ亾dé卋堺 提交于 2019-12-13 02:07:51
问题 I am experimenting with putting a UITextField inside a UITableViewCell . Now I got two working methods. Using addSubview method: UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"textFieldCell"]; UITextField *textFieldView = [[UITextField alloc] initWithFrame:CGRectMake(150, 7, 150, 30)]; [textFieldView setPlaceholder:@"Placeholder"]; [cell addSubview:textFieldView]; Using setAccessoryView method: UITableViewCell *cell = [