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
86
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,322
  • 18
  • 59
  • 94
61
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,410
  • 12
  • 69
  • 102
56
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,851
  • 4
  • 41
  • 62
45
votes
6 answers

addSubView 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]; …
Jos
  • 2,383
  • 5
  • 24
  • 30
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
  • 34
  • 56
38
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,795
  • 4
  • 22
  • 44
29
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: …
19
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
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
  • 330
  • 1
  • 3
  • 14
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
  • 31,898
  • 75
  • 232
  • 424
16
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
  • 169
  • 1
  • 6
16
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
  • 971
  • 1
  • 7
  • 16
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
  • 227
  • 2
  • 3
  • 8
15
votes
2 answers

Add subview using storyboard without external xib

I'm learning Objective-C. I have a problem with new storyboard feature. I would initialize a subview inside a main view with xib. Without using storyboard, I could do it using: controller = [[UIViewController alloc]initWithNibName:@"NibName"…
GuyFox
  • 151
  • 1
  • 1
  • 3
14
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
  • 10,294
  • 23
  • 99
  • 215
1
2 3
35 36