Questions tagged [addsubview]

Questions relating to the addSubView method of the Apple UIView class

Questions relating to the addSubView method of the Apple UIView class

540 questions
88
votes
4 answers

Difference between addSubview and insertSubview in UIView class

What is the difference between addSubview and insertSubView methods when a view is added programmatically?
Ashwani K
  • 7,880
  • 19
  • 63
  • 102
62
votes
3 answers

Adding a custom subview (created in a xib) to a view controller's view - What am I doing wrong

I've created a view in a xib (with an activity indicator, a progress view and a label). Then I've created .h/.m files: #import @interface MyCustomView : UIView { IBOutlet UIActivityIndicatorView *actIndicator; IBOutlet…
Sefran2
  • 3,578
  • 13
  • 71
  • 106
57
votes
4 answers

Apple Interface Builder: adding subview to UIImageView

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…
kpower
  • 3,871
  • 4
  • 42
  • 62
46
votes
7 answers

Add subview to UIButton

I'm trying to add subviews to a UIButton. This is working fine right now. But the button isn't clickable anymore as soon as I add the subviews. I use the following code: UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame…
Jos
  • 2,421
  • 5
  • 26
  • 30
39
votes
4 answers

Iphone remove sub view

I have a UINavigationController. On the right top i have a button on click of which i have to get a drop down table view. I created another UIViewController Class, with xib and added it as a subView to the current view. It should appear on 1st click…
Sharanya K M
  • 1,805
  • 4
  • 23
  • 44
39
votes
6 answers

How can I insert a subview below the other subviews

everyone. I have some labels that I draw them in the xib file, and add a background view using codes,but the background view is in the front of these labels, so I cant see them. So, my question is how can I add a background view below…
jxdwinter
  • 2,339
  • 6
  • 36
  • 56
31
votes
3 answers

Add a child view controller's view to a subview of the parent view controller

I want to add a tableViewController as a child view controller of a containerViewController (shown below). According to Apple's View Controller Programming Guide I can achieve this by the following lines of code inside my containerViewController: …
18
votes
6 answers

how can i set Image directly on UIView?

Can any body tell me how can I set Image directly on UIView ? Here is my code: UIView *view=[[UIView alloc]init]; [view setImage:[UIImage imageNamed:@"image.png"]];
Shilpa
  • 340
  • 1
  • 4
  • 14
18
votes
1 answer

Adding UIView to UIButton subview prevents touch events

I'm trying to add a view as a button's subview like this (btn1 is a UIButton); [self.btn1 addSubview:view1]; After adding it, the button wont give any touch related events, the button works fine without this subview added. Any thoughts?
Nicolas
  • 189
  • 1
  • 6
18
votes
3 answers

show animation when addsubview

I want to add a subview with animation. I am using add sub view so it is not showing any animation so I want to show any animation when I am doing this... I am using below code :- UIViewController *vControllerHome = [[viewTemp alloc]…
17
votes
1 answer

why is my UIView subview not rendering within the parent? (code attached)

Why is my custom UIView not rendering within the UIView container of it's parent? So what I have is: MainViewController - has a UIView "customViewContainer" (which doesn't take up the whole screen), and CustomView - is a UIView with a XIB file -…
Greg
  • 34,042
  • 79
  • 253
  • 454
17
votes
6 answers

Placing UIView To Cover TabBar & NavBar

I am trying to make a popup (UIView) with a transparent background (another UIView). Everything is working fine for the 'popup UIView' but I couldn't figure out how to bring 'transparent background UIView' (above NavigationBar and TabBar). First I…
senty
  • 12,385
  • 28
  • 130
  • 260
17
votes
4 answers

WKWebView added as Subview is not resized on rotation in Swift

I'm working on adding a new reading view to my browser app. It is another view controller, that only includes a WKWebView added as a subview with a button (and gesture) to close the view. Everything works great, but when I rotate the device, the…
PastaCoder
  • 1,031
  • 1
  • 9
  • 16
17
votes
7 answers

Difference between addChildViewController and addSubview?

Both the methods add the view as child of parentview and view can receive events. When to use which one?
user3745996
16
votes
2 answers

Adding a UIImage View as a subView to an instance of UIView

I'm practicing beginner code since I'm new and I just have run into a whole lot of confusion here... this is what I have so far UIView *catView = [[UIView alloc] init]; UIImage *image = [UIImage imageNamed:@"lolcat.png"]; UIImageView *imageView =…
Danny Swan
  • 226
  • 2
  • 3
  • 9
1
2 3
35 36