subview

UISlider won't work when it becomes a subview of a UIView other self.view

萝らか妹 提交于 2019-12-05 08:48:23
When I add my slider as subview of any view besides self.view it does not work (doesn't slide) but it works fine when it is a subview of self.view. You can see it on the other views besides self.view but it doesn't work. Here is my code: alphaSlider = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 90, 10)]; [alphaSlider setMinimumValue:0.01]; [alphaSlider setMaximumValue:1]; [alphaSlider setValue:0.5]; [alphaSlider setUserInteractionEnabled:YES]; [alphaSlider addTarget:self action:@selector(alphaSliderDidChange:) forControlEvents:UIControlEventValueChanged]; alphaSlider.continuous = YES;

Add clickable and fixed subview to UITableViewController?

瘦欲@ 提交于 2019-12-05 02:54:24
问题 I'd like to place an ADBannerView object onto my UITableView screen statically, what means that I want it to always stay above my toolbar (self.navigationController.toolbar), even when the user is scrolling the tableview. I've solved this by adding by ADBannerView as a subview to my toolbar and given it negative values for the frames origin: [self setBannerViewSize]; [self.navigationController.toolbar addSubview:bannerView]; The only problem is: I can't click and open the iAd this way - I can

Passing a touch event to all subviews of a View Controller

被刻印的时光 ゝ 提交于 2019-12-05 02:10:10
问题 I have a view controller which creates multiple subviews on top of it. All subviews and the view controller accept touches. How can i communicate the touch point information to all the subviews on the screen? Keep in mind that each subview covers the entire screen so after a few additions its a bit like pages in a book. That is, any subviews below the top subview can't be touched directly by the user. I have tried using [self.nextResponder touchesBegan:touches withEvent:event] however this

How can I addSubview to UIButton in Interface Builder

試著忘記壹切 提交于 2019-12-04 22:54:33
Like I said, I add a UIButton in Interface Builder, I want add a UILabel、UIImageView as the button's subviews, but I can't add any object on it in IB. IS anybody know how to do this? Thank you very much. I can use code to achieve that, but I want achieve it in IB, so I can use it in any class I want. I have done this before by adding a UIView (instead of the UIButton) then add the UIButton and UILabel to the UIView. The tap from the UIButton still works and you have a label too. You can also add anything else like this. I normally achieve this by Create a new UIView in Interface Builder and

iphone - determine if touch occurred in subview of a uiview

匆匆过客 提交于 2019-12-04 19:22:01
问题 In a subclass of UIView I have this: -(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { if(touch occurred in a subview){ return YES; } return NO; } What can I put in the if statement? I want to detect if a touch occurred in a subview, regardless of whether or not it lies within the frame of the UIView. 回答1: Try that: - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { return CGRectContainsPoint(subview.frame, point); } If you want to return YES if the touch is inside

How can i navigate to mainviewcontroller from subview

折月煮酒 提交于 2019-12-04 06:40:00
问题 I have just started working with swift, i have created a subview which has a button on it, i would like to use that button to take me to my mainviewcontroller. i have used same functionality for a different button however having a function in same file allows that button to work the code is below var playAgainButton = UIButton(frame: CGRectMake(0, 150, 320, 40)) playAgainButton.setTitle("Play Again", forState: UIControlState.Normal) playAgainButton.addTarget(self, action: Selector("startGame"

How to update Superview from its Subview in iPad?

Deadly 提交于 2019-12-03 22:41:59
I have a UISegmentedController i have 3 UIViewControllers Like photos,frames,gallery. I add those 3 Views in Superview Using 'addSubView'. In frames view i have added a subview that name as EditView. In EditView i have done some changes, i want to update these changes in frames view. But when am removing EditView from frames view any single method doesn't calling. Then how to update the changes from subview in superview. Tree: UISegmentedController -> Frames(Su) -> EditViews(Subview). Can any one help me.. Yuvaraj.M I found the code to update something in superview from subview. Please use

Passing a touch event to all subviews of a View Controller

本秂侑毒 提交于 2019-12-03 16:35:46
I have a view controller which creates multiple subviews on top of it. All subviews and the view controller accept touches. How can i communicate the touch point information to all the subviews on the screen? Keep in mind that each subview covers the entire screen so after a few additions its a bit like pages in a book. That is, any subviews below the top subview can't be touched directly by the user. I have tried using [self.nextResponder touchesBegan:touches withEvent:event] however this only sends the touch information from the top subview to the superview bypassing all other subviews on

Adding subview to MKMapView that's above the map but below the annotation views?

南楼画角 提交于 2019-12-03 15:33:26
问题 For an app I'm building, I have a custom "old map" effect PNG that I'd like to overlay on the MKMapView view. Unfortunately, neither way I've tried to do this is exactly right: Add a subview to the MKMapView (issue: the UIImageView for the PNG gets placed above the Annotation pins, which looks weird Make the image an annotation view itself and place it below the other ones (issue: on scroll, I have to move the annotation view image, and for a while there's just the regular map instead of the

How to remove subviews in Objective-C?

两盒软妹~` 提交于 2019-12-03 06:28:13
问题 I have added UIButton and UITextView as subviews to my view programmatically. notesDescriptionView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,460)]; notesDescriptionView.backgroundColor = [UIColor redColor]; [self.view addSubview:notesDescriptionView]; textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0,320,420)]; [self.view addSubview:textView]; printf("\n description button \n"); button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action: