Questions tagged [subview]

subview is an abstract representation of a nested hierarchy of views in a MVC framework

A subview can be defined either explicitly as a separate class, or implicitly via object composition, depending on the framework.

References

1264 questions
16
votes
4 answers

Observe changes in a UIView's subviews array with KVO

I have looked around all over for an answer to this and I have tried to implement it, but nothing is working. Basically, I need to be able to observe changes in a VC view's subviews array. If an existing view is removed from that array, I want to be…
Lizza
  • 2,769
  • 5
  • 39
  • 72
16
votes
2 answers

Hide UIView subviews

I have UIView which have n number of subviews. Let say n as 600 subviews. I know there is a way to hide all the subviews by the following code for (UIView *subView in mainView.subviews) { subView.hidden = YES; } But is there are any other proper…
Prashanth Rajagopalan
  • 718
  • 1
  • 10
  • 27
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
15
votes
4 answers

How to check if a UIView is a subview of a parent view

I have an app which I add a subview to (and remove the same subview based on user interactions). I am looking for a way to check whether the subview is present or not at any given time. For example: In the current view (UIView *viewA) I add a…
user843337
15
votes
3 answers

UIButton not working when single tap gesture is added to superview

I have a UIButton set up and hooked up to an action in my view controller as usual. Just this by itself works fine. Now, I have added the following to my view controller to set up a single tap: - (void)viewDidLoad { [super…
Andrew
  • 567
  • 2
  • 5
  • 18
15
votes
3 answers

Accessing a Top Navigation Controller from a Subview Navigation Controller

I have a my views and controllers set up like so. A Tab/Bar controller Within 1. is a root view controller within 2. is a programmatically created navigation controller, that is displayed as a subview in the root view controller. What I am trying…
Matt
  • 2,803
  • 9
  • 33
  • 57
14
votes
9 answers

iOS 7.1 removeFromSuperview crash

My app didn't have any crash until iOS 7.1 came out. Now on any removeFromSuperview method, crash. For example: I got view controllers, and when I want to remove a view controller, I remove all of its subviews, and then remove from the stack (stack:…
Magyar Miklós
  • 4,182
  • 2
  • 24
  • 42
13
votes
2 answers

iOS - adding/removing a subview programmatically

Ok I want to add a UIImageView as a subview and then remove it after a couple of seconds in the way a splash screen works. I found three different approaches to do it but I can not understand which one is the best approach according to Objective-C…
andreasv
  • 689
  • 3
  • 11
  • 26
13
votes
5 answers

Adding a UINavigationController as a subview of UIView

I'm trying to display a UILabel on top of a UINavigationController. The problem is that when I add the UILabel as a subview of UIWindow it will not automatically rotate since it is not a subview of UIViewController (UIViewController automatically…
Senseful
  • 86,719
  • 67
  • 308
  • 465
13
votes
2 answers

IOS, UIView, Detect Hidden State Change in Subview

Is there anyway to detect a hidden state change (or other change) in a sub view in a UIView (not UIViewController). Would like to detect this async somehow. There are reasons for my madness.
ort11
  • 3,359
  • 4
  • 36
  • 69
12
votes
1 answer

NSView equivalent of UIView Clip Subviews?

Is there a way to disable clipping of subviews of NSView? In UIView there is a “clip subviews checkbox” and the backing clipToBounds property, but I cant find anything similar in Cocoa. Here is my scenario: I have this grey dot that you can drag…
user961889
  • 351
  • 2
  • 12
11
votes
4 answers

Monotouch: Remove all subviews from a view

I am trying to remove all the subviews from a UIView. I tried the following to no effect: for (int i = 0; i < this.Subviews.Length; i++) { this.Subviews[i].RemoveFromSuperview (); }
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
11
votes
1 answer

How to query subview of UIView with tag?

i insert 2 UIImageView with tag 1 and 100 to UIView, how to access to UIView and check how many subview on it or select tag 1 to be the top of view ?
RAGOpoR
  • 8,118
  • 19
  • 64
  • 97
10
votes
4 answers

How to remove a subview from a cell's content view?

I have added a UIWebview to the cell's content view UIWebView *webview = [UIWebView alloc]init]; [cell.contentView addSubview:webview]; Now I intend to remove 'webview' from the cell's contentview. Can I do the following? Method 1: [webview…
Zhen
  • 12,361
  • 38
  • 122
  • 199
10
votes
2 answers

iOS how to uiview know appear and disappear?

In view on viewcontroller i can know when view on screen by viewDidAppear. But in subclassed view from UIView can't know. In android each view has methods didAttachToWindow and didDeattachFromWindow So i can know when view appear and disappear from…
Dmitry Nelepov
  • 7,246
  • 8
  • 53
  • 74
1 2
3
84 85