subview

Apple Interface Builder: adding subview to UIImageView

烈酒焚心 提交于 2019-12-27 17:02:53
问题 I created UIImageView with the help of Interface Bulder. Now I want to place label inside it (as its subview). In code I can type something like: [myUIImageView addSubview:myUILabel]; But can I do it with the help of IB? I found the solution for UIView , but can't find something similar for UIImageView . 回答1: You cannot add a subview to UIImageView in interface builder for reasons only known to Apple! You are right in saying that you can addSubview programmatically, but then, the overhead of

Debugging strategies when UITableView's cells don't load?

送分小仙女□ 提交于 2019-12-25 04:57:15
问题 I am trying to embed a UITableView into my ViewController's main UIView that is 75% the width of the screen. Ideally this UITableView would also be embedded into a Navigation Controller. Also, it seems I cannot use UIContainerViews with iOS 5 because I encounter the error "Could not instantiate class named UIStoryboardEmbedSegueTemplate" (cf. NSInvalidUnarchiveOperationException with ContainerView). To do this, I have created a UIView within my ViewController's main UIView that is 75% the

integrate a view into another view in iphone

只愿长相守 提交于 2019-12-25 03:09:55
问题 Good Day! i want to add a subview in another view in iphone. and i want that child view to be of size which i want like if i want to change its height/width i can. Can somebody please suggest me something or help me out in this regard. Thanks in advance 回答1: you can do it by UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)] ; [self.view addSubview:newView]; 来源: https://stackoverflow.com/questions/2620681/integrate-a-view-into-another-view-in-iphone

Add MPVolumeView to bottom toolbar

懵懂的女人 提交于 2019-12-24 17:42:22
问题 I am trying to add an instance of MPVolumeView to the bottom bar of my navigation controller.(the box for toolbar is ticked) I do not get any errors with my code, but when I run the project on my device the volume slider is not showing. Thanks in advance for any suggestions, here is my code: @interface ViewController () { AVPlayer *vPlayer; AVPlayerItem *playerItem; UISegmentedControl *segm; UIToolbar *toolbar; } @end @implementation ViewController @synthesize myViewVolume; @synthesize

Add MPVolumeView to bottom toolbar

♀尐吖头ヾ 提交于 2019-12-24 17:42:17
问题 I am trying to add an instance of MPVolumeView to the bottom bar of my navigation controller.(the box for toolbar is ticked) I do not get any errors with my code, but when I run the project on my device the volume slider is not showing. Thanks in advance for any suggestions, here is my code: @interface ViewController () { AVPlayer *vPlayer; AVPlayerItem *playerItem; UISegmentedControl *segm; UIToolbar *toolbar; } @end @implementation ViewController @synthesize myViewVolume; @synthesize

How to remove a subview from memory and display right away?

回眸只為那壹抹淺笑 提交于 2019-12-24 14:52:37
问题 How do I remove a UIImageView's subview (a View Controller in this case) from memory and display immediately? [myGroovySubview release]; isn't doing it. Any help appreciated! Thanks // :) 回答1: myGroovySubview.hidden = YES; hides the view. You could also try to remove it from its superview with [myGroovySubview removeFromSuperview]; If you removed it from its superview, the release call should automatically remove it from memory since the reference count should be zero after that call. 来源:

Adding an entirely different view behind the current view

江枫思渺然 提交于 2019-12-24 11:35:23
问题 Summary: I am trying to implement a pan gesture that works just like Apple's default pan back gesture (interactivePopGestureRecognizer). The only difference is that it snaps all the way back to the primary view of a splitview controller rather than just going back one view on the stack. This is accomplished with popToRootViewController. What I can currently do: My subclass of the UIScreenEdgePanGestureRecognizer is able to follow the user's touch and animate to the proper location based on

Subview shifting down 20 pixels when called in AppDelegate

偶尔善良 提交于 2019-12-24 03:01:22
问题 I'm facing this issue when I'm calling AdMob ad with [rootController.view addSubview:adMobAd]; //setup the ad Upon returning from the ad being clicked the AdMob frame moves down 20 pixels. However it seems that this is not a AdMob issue, but a issue that is also discussed here: https://discussions.apple.com/thread/2288486 However I couldn't get it to work, any ideas? 回答1: 20 pixels is the height of the status bar. If the app will don't use the status bar make sure all the XIB files you are

Subview shifting down 20 pixels when called in AppDelegate

不羁的心 提交于 2019-12-24 03:01:07
问题 I'm facing this issue when I'm calling AdMob ad with [rootController.view addSubview:adMobAd]; //setup the ad Upon returning from the ad being clicked the AdMob frame moves down 20 pixels. However it seems that this is not a AdMob issue, but a issue that is also discussed here: https://discussions.apple.com/thread/2288486 However I couldn't get it to work, any ideas? 回答1: 20 pixels is the height of the status bar. If the app will don't use the status bar make sure all the XIB files you are

How can I constrain a subview so that it cannot be dragged outside of it's parent view's bounds. (iOS)

牧云@^-^@ 提交于 2019-12-23 05:19:30
问题 How to constrain the position of a subview within its parent view. I have a subview within a UIView. The subview can be dragged via gesture recognizer. How can I constrain the subview so that it cannot be dragged outside of it's parent view's bounds. 回答1: to constrain a draggable view, you need to check for its position while you move it and then force it to the constrained position if it exceeds the boundaries. So assuming you use touchesMoved : - (void)touchesMoved:(NSSet *)touches