subview

removing Views from SubView

时间秒杀一切 提交于 2019-12-11 16:03:40
问题 I have a App that uses the In App feature. -(void) completeTransaction: (skPaymenttransaction *)transaction{ } When the above method gets called i want to remove all subviews and go back to my main menu window (the first view in my App). Can anyone suggest to cleanest and best way to do this? Cheers EDIT: Just to make things clear Im not sure if this makes a difference but i have my main menu screen, then iam doing the following with an enter button. UIViewController *controller = [

Detecting UIButton touches on a subview

馋奶兔 提交于 2019-12-11 11:42:19
问题 I have added a subview which contains a UIButton control. This subview is added to its superview programatically. I need to perform an action when this button is tapped, but since it's contained within its own subview, I can't hook an IBAction up to the view controller in order to push another view controller. Is there an easy way to detect that the button is tapped and call a method within its super view? 回答1: You can do everything programmatically: [buttonName addTarget:self action:

How to remove a SubView from a NSSplitView in cocoa?

廉价感情. 提交于 2019-12-11 10:17:09
问题 I'm loading two different views with this IBActions - (IBAction)showFirstView:(id)sender{ theDetailViewController = [DetailViewController new]; [theDetailViewController initWithNibName:@"DetailView" bundle:nil]; NSView *splitRightView = [[theSplitView subviews] objectAtIndex:1]; NSView *aDetailView = [theDetailViewController view]; [aDetailView setFrame:[splitRightView bounds]]; [aDetailView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [splitRightView addSubview

How can I make my cells selectable when there is an UIView below the UICollectionView?

ⅰ亾dé卋堺 提交于 2019-12-11 08:39:48
问题 I have a collection view, and added a UIView below it. The cells shows up on top of it, but they aren't selectable. How can I make them selectable again? What I have tried so far: UIView has zPosition -1 and my cells have +1 UIView.isUserInteractionEnabled = true I have tried to add the UIView both as view.addSubview and collectionView?.addSubview collectionView?.insertSubview(UIView, belowSubview: collectionView!) This guy has the same problem, with no solution provided: Inserting Subview

How to tell when a subView is removed a UIView

╄→гoц情女王★ 提交于 2019-12-11 07:39:29
问题 Basically i wanted to implement a popup UIView so i followed what was posted here POP-UP UIView "IMDB App" style This works very well. However i have one query. My main view is a tableView. so when a view is popped up i disable scrolling in the table. Now when the popup subView is removed, i need to re-enable scrolling. How do i achieve that? i can't use willRemoveFromSuperview because the popup view is loading a different NIB altogether. Should i use Notifications? hope i was clear with

Text not fitting in UILabel Swift

青春壹個敷衍的年華 提交于 2019-12-11 03:49:55
问题 i am getting json data into uiwebview(which is added through storyboard) and if the json data is empty i am adding a subview(which is added programatically).and in that subview i am adding a label. when i run it i can see the subview and the label but its size is big, so it goes out of the subview. The code i have is var detailView = UIView(frame: CGRectMake(0, 143, 568, 376)) //Overlapping the UIWebview //detailView.backgroundColor = UIColor.blackColor() detailView.contentMode =

Inserting Subview Below UICollectionView

隐身守侯 提交于 2019-12-10 20:01:47
问题 When I add a subview below a UICollectionView, sometimes the subview shows up above the UICollectionView cells. Here is the subview insertion code: [self.collectionView insertSubview:self.garmentView atIndex:0]; Not sure if I'm not following a best practice or otherwise missing something obvious. Any assistance appreciated. ** Edit ** It might be worth noting that this only happens in landscape, when the rightmost cell is zoomed in. 回答1: I think self.garmentView.layer.zPosition = -1 [self

Bring previously added view to front

 ̄綄美尐妖づ 提交于 2019-12-10 18:34:02
问题 My problem is the following: I have a view and to that view I add 3 subViews( view1 , view2 , view3 ) in that order. The views slightly overlap. I want to bring the first view to the top but I just can't get it to work. I tried adding the views with insertSubview:atIndex: and giving view1 a larger index and I tried using addSubview: and then bringSubviewToTop but nothing seems to work. Any ideas? P.S. I can't add the views in a different order. They have to be added in this order. 回答1:

Objective-C Copying a view

橙三吉。 提交于 2019-12-10 18:06:27
问题 So I've got a quick question here... I've got an instance of a view controller object, lets call it viewCon1 , and it has several subview's placed on it each with unique properties. Lets call them sub1 , sub2 , and sub3 . Now, I add each of these subviews programatically doing something to the extent of: //create the subviews TaskUIButton *sub1 = [[TaskUIButton alloc] init]; TaskUIButton *sub2 = [[TaskUIButton alloc] init]; TaskUIButton *sub3 = [[TaskUIButton alloc] init]; //add them to

Get the frame of a UIStackView subViews

南楼画角 提交于 2019-12-10 15:39:35
问题 I have created a UIStackView in IB which has the distribution set to Fill Equally. I am looking to get the frame for each subView but the following code always returns (0, 0, 0, 0). class ViewController: UIViewController { @IBOutlet weak var stackView: UIStackView! override func viewDidLoad() { super.viewDidLoad() let pView = UIView() let sView = UIView() pView.backgroundColor = UIColor.red sView.backgroundColor = UIColor.orange stackView.addArrangedSubview(pView) stackView.addArrangedSubview