subview

UICollectionView cell subviews do not resize

一笑奈何 提交于 2019-11-26 09:23:12
问题 In a CollectionView , some cells should have an additional subview or layer. The CollectionView can be told to resize it\'s cells, thus all content needs to resize appropriately. Currently, the cell is initialized from a nib containing a cell with imageview; the cell nib is linked to a custom UICollectionViewCell subclass, that only does the init. Autoresize subviews is checked. The CollectionView is told to resize the cell by a value derived and returned in sizeForItemAtIndexPath: . I have

Cannot put a google maps GMSMapView in a subview of main main view?

我的未来我决定 提交于 2019-11-26 08:08:30
问题 I\'m struggling with this problem! I want to add a google maps GMSMapView into a UIView that is only a portion of the main UIView of my ViewController . It should be simple... I created with the storyboard a UIView of the size I want and put it in the main UIView . Snippet from Interface file: @interface MapViewController : UIViewController <CLLocationManagerDelegate> @property(nonatomic) IBOutlet GMSMapView *mapView; With the mapView linked with this UIView inside the main UIView . What I do

Remove all subviews?

限于喜欢 提交于 2019-11-26 07:51:17
问题 When my app gets back to its root view controller, in the viewDidAppear: method I need to remove all subviews. How can I do this? 回答1: Edit: With thanks to cocoafan: This situation is muddled up by the fact that NSView and UIView handle things differently. For NSView (desktop Mac development only), you can simply use the following: [someNSView setSubviews:[NSArray array]]; For UIView (iOS development only), you can safely use makeObjectsPerformSelector: because the subviews property will

How can I loop through all subviews of a UIView, and their subviews and their subviews

℡╲_俬逩灬. 提交于 2019-11-26 04:09:40
问题 How can I loop through all subviews of a UIView, and their subviews and their subviews? 回答1: Use recursion: // UIView+HierarchyLogging.h @interface UIView (ViewHierarchyLogging) - (void)logViewHierarchy; @end // UIView+HierarchyLogging.m @implementation UIView (ViewHierarchyLogging) - (void)logViewHierarchy { NSLog(@"%@", self); for (UIView *subview in self.subviews) { [subview logViewHierarchy]; } } @end // In your implementation [myView logViewHierarchy]; 回答2: Well here is my solution using