I am reading code for an app that contains 40+ ViewController. How would you know which ViewController is the current.
What I have tried:
CBIntrospect: execute a UIAlertView with a
message:NSStringFromClass([self class])?
looked at adding
something to NotificationCenter and act on some method when a view
controller is piped?
Using the runtime.h to dynamically add a
method?
Any idea is appreciated
Try this:
- (UIViewController *)topViewController
{
return [self topViewController:self.window.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)viewController
{
if (viewController.presentedViewController == nil) {
return viewController;
}
if ([viewController.presentedViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController *navigationController = (UINavigationController *) viewController.presentedViewController;
UIViewController *topViewController = [navigationController.viewControllers lastObject];
return [self topViewController:topViewController];
}
UIViewController *presentedViewController = viewController.presentedViewController;
return [self topViewController:presentedViewController];
}
I often use [self.window recursiveDescription] to print all UIViews through my app. This is not VC, but can be also useful to you.
Just set the breakpoint everywhere you need and type (replace window with your key "UIWindow"):
[window recursiveDescription]
You'll see common result:
<UIWindow: 0xc0275c0; frame = (0 0; 320 568); gestureRecognizers = <NSArray: 0xc027b20>; layer = <UIWindowLayer: 0xc0276e0>>
| <UILayoutContainerView: 0xc0196b0; frame = (0 0; 320 568); autoresize = W+H; gestureRecognizers = <NSArray: 0xc022fa0>; layer = <CALayer: 0xc019790>>
| | <UINavigationTransitionView: 0xc011a60; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xc00ebd0>>
| | | <UIViewControllerWrapperView: 0xb34ab10; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0xb34abe0>>
| | | | <UIView: 0xc44a7c0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0xc44a820>>
| | | | | <UITableView: 0xdb4a000; frame = (0 0; 320 468); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0xc449ac0>; layer = <CALayer: 0xc448550>; contentOffset: {-0, -63}>
| | | | | | <UITableViewWrapperView: 0xc44a440; frame = (0 0; 320 468); autoresize = W+H; layer = <CALayer: 0xc44a510>>
| | | | | | | <WorkspaceCell: 0xc023a50; baseClass = UITableViewCell; frame = (0 1; 320 44); autoresize = W; layer = <CALayer: 0xc00cad0>>
| | | | | | | | <UITableViewCellScrollView: 0xc02c400; frame = (0 0; 320 44); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0xc02c980>; layer = <CALayer: 0xc02c610>; contentOffset: {0, 0}>
| | | | | | | | | <UITableViewCellContentView: 0xc022980; frame = (0 0; 320 43.5); opaque = NO; gestureRecognizers = <NSArray: 0xc02d2f0>; layer = <CALayer: 0xc02b0c0>>
| | | | | | | | | | <UIImageView: 0xc0233f0; frame = (15 7; 29 29); clipsToBounds = YES; autoresize = RM+TM+BM; userInteractionEnabled = NO; layer = <CALayer: 0xc0291e0>>
| | | | | | | | | | <UILabel: 0xc0262e0; frame = (60 11; 240 21); text = 'Alterplay'; clipsToBounds = YES; opaque = NO; autoresize = W+RM+TM+BM; userInteractionEnabled = NO; layer = <CALayer: 0xc0276a0>>
| | | | | | | | | | <UILabel: 0xc023130; frame = (15 7; 29 29); text = 'A'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0xc0231d0>>
| | | | | | | | | <_UITableViewCellSeparatorView: 0xc02e4e0; frame = (0 43.5; 320 0.5); layer = <CALayer: 0xc02e5b0>>
| | | | | | | | | <_UITableViewCellSeparatorView: 0xc02e850; frame = (0 0; 320 0.5); layer = <CALayer: 0xc02e8c0>>
| | | | | | <UIImageView: 0xc449210; frame = (0 465.5; 320 3.5); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0xc4494a0>>
| | | | | | <UIImageView: 0xc449680; frame = (316.5 414; 3.5 55); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0xc449760>>
| | | | | <UIView: 0xc44a850; frame = (0 518; 320 50); autoresize = W+TM; layer = <CALayer: 0xc44a8b0>>
| | | | | | <UIButton: 0xc4458a0; frame = (75 14; 172 22); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0xc4459d0>>
| | | | | | | <UIImageView: 0xb359ce0; frame = (27.5 4; 117 14); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xb359560>>
| | | | | <UIView: 0xc44a9f0; frame = (0 468; 320 50); autoresize = LM+RM+TM; layer = <CALayer: 0xc44aa50>>
| | | | | | <UIButton: 0xc447b10; frame = (101 10; 119 30); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0xc447c00>>
| | | | | | | <UIButtonLabel: 0xb34c1a0; frame = (32 3; 55 24); text = 'Logout'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xb34c2b0>>
| | | | | <UIImageView: 0xc44ab00; frame = (0 424; 320 44); clipsToBounds = YES; opaque = NO; autoresize = LM+RM+TM; layer = <CALayer: 0xc44ab90>>
| | <UINavigationBar: 0xc019980; frame = (0 20; 320 44); opaque = NO; autoresize = W; gestureRecognizers = <NSArray: 0xc01b9f0>; layer = <CALayer: 0xc019ae0>>
| | | <_UINavigationBarBackground: 0xc01a180; frame = (0 -20; 320 64); opaque = NO; autoresize = W; userInteractionEnabled = NO; layer = <CALayer: 0xc01a2b0>>
| | | | <_UIBackdropView: 0xc01c0d0; frame = (0 0; 320 64); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <_UIBackdropViewLayer: 0xc01dca0>>
| | | | | <_UIBackdropEffectView: 0xc01e6b0; frame = (0 0; 320 64); clipsToBounds = YES; opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CABackdropLayer: 0xc01e970>>
| | | | | <UIView: 0xc01f2a0; frame = (0 0; 320 64); hidden = YES; opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0xc01f400>>
| | | | <UIImageView: 0xc01a540; frame = (0 64; 320 0.5); userInteractionEnabled = NO; layer = <CALayer: 0xc01a610>>
| | | <UINavigationItemView: 0xc023490; frame = (111.5 8; 97.5 27); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc023570>>
| | | | <UILabel: 0xc023920; frame = (0 3; 97.5 22); text = 'Workspaces'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc023a20>>
| | | <_UINavigationBarBackIndicatorView: 0xc029150; frame = (8 12; 12.5 20.5); alpha = 0; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc029240>>
Related
I have a project where I am mixing native code with React Native. I show the React view like this:
self.reactView = [[RCTRootView alloc] initWithBridge:bridge moduleName:#"DemoPage" initialProperties:initialProperties];
[self.view addSubview:self.reactView];
The above works and the view displays correctly. The view is a list of items. When a list item is selected it should respond back to my view controller and I will push a native view controller. I do this with a Native Module like this:
RCT_EXPORT_MODULE(NavigationUtils);
RCT_EXPORT_METHOD(navigateWithParameters:(NSString *)parameters)
{
ViewController *viewController = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
}
My problem is, when trying to pushViewController:, self.navigationController is nil and so the push does nothing.
presentViewController: also does not work.
self.navigationController is not nil in viewWillAppear: or viewDidAppear:
Does anyone know how I can push a new native view controller from a React Native Module?
Here is an edited version of the recursiveDescription for the view hierarchy.
<UIWindow: 0x102a10970; frame = (0 0; 414 736); autoresize = W+H; tintColor = UIExtendedSRGBColorSpace 0.313725 0.52549 0.764706 1; gestureRecognizers = <NSArray: 0x17405ab20>; layer = <UIWindowLayer: 0x17422ae20>>
| <UIView: 0x102b55ff0; frame = (0 0; 414 736); autoresize = W+H; gestureRecognizers = <NSArray: 0x17064e550>; layer = <CALayer: 0x170631220>>
| | <UIView: 0x102b6b580; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x170631260>>
| | | <UILayoutContainerView: 0x102b689d0; frame = (0 0; 314 736); hidden = YES; autoresize = RM+H; gestureRecognizers = <NSArray: 0x17064d410>; layer = <CALayer: 0x17062f4e0>>
| | | | <UINavigationTransitionView: 0x102b6ab20; frame = (0 0; 314 736); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x170631100>>
| | | | | <UIViewControllerWrapperView: 0x102b74ad0; frame = (0 0; 314 736); autoresize = W+H; layer = <CALayer: 0x1706350c0>>
| | | | | | <UITableView: 0x10388f400; frame = (0 0; 314 736); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1748569e0>; layer = <CALayer: 0x17482a600>; contentOffset: {0, 0}; contentSize: {314, 630}>
| | | | | | | ...Cells and seperators
| | | | <UINavigationBar: 0x102b68b90; frame = (0 20; 314 44); opaque = NO; autoresize = W; gestureRecognizers = <NSArray: 0x17064db00>; layer = <CALayer: 0x170630c60>>
| | | | | <_UIBarBackground: 0x102b68e40; frame = (0 -20; 314 64); userInteractionEnabled = NO; layer = <CALayer: 0x170630ce0>>
| | | | | | <UIImageView: 0x102b69450; frame = (0 64; 314 0.333333); userInteractionEnabled = NO; layer = <CALayer: 0x170630d20>> - (null)
| | | | | | <UIVisualEffectView: 0x102b69640; frame = (0 0; 314 64); layer = <CALayer: 0x170630d40>>
| | | | | | | <_UIVisualEffectBackdropView: 0x102b69a80; frame = (0 0; 314 64); autoresize = W+H; userInteractionEnabled = NO; layer = <UICABackdropLayer: 0x170630da0>>
| | | | | | | <_UIVisualEffectFilterView: 0x102b6a380; frame = (0 0; 314 64); autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x170630f60>>
| | | | | | | <_UIVisualEffectFilterView: 0x102a850b0; frame = (0 0; 314 64); alpha = 0.85; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x17482c3e0>>
| | | | | <UIImageView: 0x102a7e940; frame = (89 3.33333; 136 37.6667); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x174829240>> - (null)
| | | | | <_UINavigationBarBackIndicatorView: 0x102b6a730; frame = (12 11.6667; 13 21); alpha = 0; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x170631000>> - Back
| | | <MMDrawerCenterContainerView: 0x102b6b8d0; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x1706312c0>>
| | | | <UILayoutContainerView: 0x102aafb40; frame = (0 0; 414 736); autoresize = W+H; gestureRecognizers = <NSArray: 0x170441890>; layer = <CALayer: 0x17422ad60>>
| | | | | <UINavigationTransitionView: 0x102ab02e0; frame = (0 0; 414 736); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x17422adc0>>
| | | | | | <UIViewControllerWrapperView: 0x102a828b0; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x174a201a0>>
| | | | | | | <UIView: 0x102b98e20; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x170c209a0>>
| | | | | | | | <RCTRootView: 0x102b9a8d0; frame = (0 64; 414 736); autoresize = W+H; layer = <CALayer: 0x170c221c0>>
| | | | | | | | | ...subviews of RCTRootView
| | | | | <UINavigationBar: 0x102aaf160; frame = (0 20; 414 44); opaque = NO; autoresize = W; gestureRecognizers = <NSArray: 0x174258690>; layer = <CALayer: 0x17422a720>>
| | | | | | <_UIBarBackground: 0x102aaf410; frame = (0 -20; 414 64); userInteractionEnabled = NO; layer = <CALayer: 0x17422ab40>>
| | | | | | | <UIImageView: 0x102a9e1e0; frame = (0 64; 414 0.333333); userInteractionEnabled = NO; layer = <CALayer: 0x17422a9c0>> - (null)
| | | | | | | <UIVisualEffectView: 0x102a9e3d0; frame = (0 0; 414 64); layer = <CALayer: 0x174230c60>>
| | | | | | | | <_UIVisualEffectBackdropView: 0x102a98840; frame = (0 0; 414 64); autoresize = W+H; userInteractionEnabled = NO; layer = <UICABackdropLayer: 0x1742327c0>>
| | | | | | | | <_UIVisualEffectFilterView: 0x102a98ba0; frame = (0 0; 414 64); autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x174233560>>
| | | | | | | | <_UIVisualEffectFilterView: 0x102ab1380; frame = (0 0; 414 64); alpha = 0.85; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x174233660>>
| | | | | | <<UINavigationItemView: 0x102ab04c0; frame = (169.333 8; 75.3333 27); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x174422a80>>: item=<<UINavigationItem: 0x1703c6900>: title:'Accounts'> title=Accounts>
| | | | | | | <UILabel: 0x102b1a660; frame = (0 3; 75.3333 21.3333); text = 'Accounts'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x17488cda0>>
| | | | | | <UINavigationButton: 0x102a80b40; frame = (9 6; 48 30); opaque = NO; tintColor = UIExtendedSRGBColorSpace 0.313725 0.52549 0.764706 1; layer = <CALayer: 0x174830340>>
| | | | | | | <UIImageView: 0x102b66cd0; frame = (11 2; 26 26); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x170c20bc0>> - (null)
| | | | | | <_UINavigationBarBackIndicatorView: 0x102ab00f0; frame = (12 11.6667; 13 21); alpha = 0; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x17422ad20>> - Back
Did you tried to present your vc from rootViewController ?
UIViewController *rootVC = [[[UIApplication sharedApplication] window] rootViewController];
[rootVC presentViewController:viewController animated:YES completion: nil];
Update:
Regarding your view hierarchy, I can suggest to use a little bit of ugly introspection for pushing :
UIViewController *rootVC = [[[UIApplication sharedApplication] window] rootViewController];
if ([rootVC isKindOfClass:[MMDrawerController class]]) {
MMDrawerController *drawer = (MMDrawerController *)rootVC;
UIViewController *realRootVC = drawer.centerViewController;
if (realRootVC != nil) {
if (realRootVC.navigationController != nil) {
[realRootVC.navigationController presentViewController:viewController animated:YES completion: nil];
} else if ([realRootVC isKindOfClass:[UINavigationController class]]) {
UINavigationController *nv = (UINavigationController *)realRootVC;
[nv presentViewController:viewController animated:YES completion: nil];
}
}
}
I'm in my SKScene and I want to unhide a text field in the presenting view controller. I'm using NSNotificationCenter to call a function in my view controller and I've even seen the code arrive at the function and pass the line where the textfield is unhidden, but for some strange reason it doesn't appear. Any thoughts?
Here is the output from the lldb:
<UIWindow: 0x7bf3dbb0; frame = (0 0; 320 568); autoresize = W+H; gestureRecognizers = <NSArray: 0x7bf4dd60>; layer = <UIWindowLayer: 0x7bf364c0>>
| <UITransitionView: 0x833c34e0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x833c3720>>
| | <SKView: 0x7c86de00; frame = (0 0; 320 568); autoresize = W+H; autoresizesSubviews = NO; gestureRecognizers = <NSArray: 0x7d48e4c0>; layer = <CAEAGLLayer: 0x7bf38d20>>
| | | <UIButton: 0x7bf475f0; frame = (227 458; 64 90); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7bf47120>>
| | | | <UIImageView: 0x837dca00; frame = (0 0; 64 90); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x837dcae0>> - (null)
| | | | <UIButtonLabel: 0x837dcbf0; frame = (18 39.5; 28.5 13.5); text = 'Store'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x837dcd00>>
| | | <OptionMenu: 0x7bf3b300; frame = (43 55; 114 493); hidden = YES; autoresize = RM+BM; layer = <CALayer: 0x7bf3b530>>
| | | | <UIView: 0x7bf2c1c0; frame = (0 0; 600 600); autoresize = RM+BM; layer = <CALayer: 0x7bf2c560>>
| | | | | <UIImageView: 0x7d433820; frame = (0 0; 600 600); autoresize = RM+BM; tag = 1; layer = <CALayer: 0x7d42a2c0>> - (null)
| | | | | <UILabel: 0x7bf2b0f0; frame = (38 15; 562 42); text = ''; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7bf2c280>>
| | | | | <UILabel: 0x7d43b1f0; frame = (49 88; 321 334); text = 'Dear Samuel,
I'll be spe...'; opaque = NO; autoresize = RM+BM; layer = <_UILabelLayer: 0x7d43a6e0>>
| | | | | <UIButton: 0x7bf2e790; frame = (31 15; 50 50); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7bf3c120>>
| | | | | | <UIImageView: 0x837dc5e0; frame = (0 0; 50 50); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x837dc6c0>> - (null)
| | | <_UILayoutGuide: 0x7bf3bf50; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7bf645c0>>
| | | <_UILayoutGuide: 0x7bf3bb30; frame = (0 568; 0 0); hidden = YES; layer = <CALayer: 0x7bf29910>>
| | | <UITextField: 0x833bf810; frame = (20 150; 280 31); text = ''; clipsToBounds = YES; alpha = 0; opaque = NO; tag = 2; gestureRecognizers = <NSArray: 0x83470100>; layer = <CALayer: 0x833bfb10>>
| | | | <_UITextFieldRoundedRectBackgroundViewNeue: 0x833c19f0; frame = (0 0; 280 31); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x833c1bf0>> - (null)
| | | | <UITextFieldLabel: 0x833c1220; frame = (7 2; 266 27); text = 'Password'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x833c1330>>
I'm having problems tracking down some conflicting constraints. The AutoresizingMask has been added for me, and the other constraint I added in an attempt to understand what is going on:
2015-09-26 22:27:14.959 Darkenss[26537:8462681] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7fc461fe9110 UICollectionView:0x7fc463090000.top == UIView:0x7fc461fc6620.topMargin + 302>",
"<NSAutoresizingMaskLayoutConstraint:0x7fc461d3f820 h=--- v=--- 'UIView-Encapsulated-Layout-Top' V:[UIView:0x7fc461fc6620]-(0)-|>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fc461fe9110 UICollectionView:0x7fc463090000.top == UIView:0x7fc461fc6620.topMargin + 302>
I don't see how these two constraints are actually in conflict.
The view hierarchy is:
<UIView: 0x7fc461fc6620; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x7fc461fc48a0>>
| <UIImageView: 0x7fc461fd4f50; frame = (0 0; 600 600); clipsToBounds = YES; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461fc7ea0>>
| <UILabel: 0x7fc461fcba20; frame = (28 68; 300 48); text = 'Darkness AP'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7fc461fcb910>>
| <Darkenss.UIDescreteSliderWithCircles: 0x7fc461e477c0; frame = (28 124; 544 30); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461c2df00>; layer = <CALayer: 0x7fc461fb09b0>>
| <UIButton: 0x7fc461e8c8e0; frame = (28 162; 93 128); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461c2c770>; layer = <CALayer: 0x7fc461e99bb0>>
| | <UIImageView: 0x7fc461d2ad70; frame = (0 6.5; 93 115); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d2af10>>
| <UIButton: 0x7fc461e1ee60; frame = (129 162; 92 128); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461c2ccd0>; layer = <CALayer: 0x7fc461e1beb0>>
| | <UIImageView: 0x7fc461d38d50; frame = (0 6.5; 92 115); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d38ef0>>
| <UIButton: 0x7fc461e20c10; frame = (229 162; 93 128); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461c2d1f0>; layer = <CALayer: 0x7fc461e372b0>>
| | <UIImageView: 0x7fc461d23ab0; frame = (0 6.5; 93 115); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d23c50>>
| <UIButton: 0x7fc461e04d20; frame = (330 162; 92 128); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461c2d400>; layer = <CALayer: 0x7fc461e225a0>>
| | <UIImageView: 0x7fc461d2a9a0; frame = (0 6.5; 92 115); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d43d80>>
| <UIButton: 0x7fc461e31e20; frame = (430 162; 81 128); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461e99d00>; layer = <CALayer: 0x7fc461e31cd0>>
| | <UIImageView: 0x7fc461d2c750; frame = (0 6.5; 81 115); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d1e660>>
| <UIButton: 0x7fc461e374f0; frame = (16 97.5; 145.5 128); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7fc461e34cb0>>
| | <UIImageView: 0x7fc461d20da0; frame = (0 0; 145.5 128); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d47ed0>>
| | <UIImageView: 0x7fc461e55d50; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461e3d850>>
| | <UIButtonLabel: 0x7fc461d20f40; frame = (0 55.5; 27.5 17.5); text = 'Run
Darkness
Cycle'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7fc461d212f0>>
| <UIButton: 0x7fc461e2d510; frame = (169.5 97.5; 181.5 128); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7fc461e60e10>>
| | <UIImageView: 0x7fc461d51e50; frame = (0 0; 181.5 128); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d431f0>>
| | <UIImageView: 0x7fc461d3c3c0; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d3c560>>
| | <UIButtonLabel: 0x7fc461d5c0e0; frame = (26.5 55.5; 128.5 17.5); text = ' Continue Combo '; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7fc461d52250>>
| <UIImageView: 0x7fc461fcda20; frame = (4 302; 592 294); clipsToBounds = YES; hidden = YES; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461fcd030>>
| <UICollectionView: 0x7fc463090000; frame = (4 310; 367 353); clipsToBounds = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fc461e45640>; layer = <CALayer: 0x7fc461e3b3a0>; contentOffset: {0, 0}; contentSize: {367, 54}> collection view layout: <UICollectionViewFlowLayout: 0x7fc461e468d0>
| | <Darkenss.AddTrackerViewCell: 0x7fc4640217f0; baseClass = UICollectionViewCell; frame = (0 0; 54 54); layer = <CALayer: 0x7fc464020fc0>>
| | | <UIButton: 0x7fc4640219c0; frame = (4 4; 46 46); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7fc464020e70>>
| | | | <UIImageView: 0x7fc464024140; frame = (0 0; 46 46); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7fc4640200b0>>
| | | <UIView: 0x7fc464022110; frame = (0 0; 54 54); autoresize = W+H; gestureRecognizers = <NSArray: 0x7fc4640228f0>; layer = <CALayer: 0x7fc464022270>>
| | <Darkenss.CounterArrayCellView: 0x7fc464032270; baseClass = UICollectionViewCell; frame = (54.5 0; 258 53); alpha = 0; layer = <CALayer: 0x7fc464032040>>
| | | <UIView: 0x7fc4640324d0; frame = (0 0; 258 53); gestureRecognizers = <NSArray: 0x7fc464032d10>; layer = <CALayer: 0x7fc464032630>>
| | | | <Darkenss.CounterArrayView: 0x7fc464032d40; frame = (0 0; 94 102); layer = <CALayer: 0x7fc464034b60>>
| | | | | <UILabel: 0x7fc464033190; frame = (6 6; 82 0); text = 'Treasure'; hidden = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7fc464033390>>
| | | | | | <_UILabelContentLayer: 0x7fc461d84ee0> (layer)
| | | | | <UICollectionView: 0x7fc46388e800; frame = (6 14; 82 82); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fc4640340a0>; layer = <CALayer: 0x7fc464033ba0>; contentOffset: {0, 0}; contentSize: {82, 81}> collection view layout: <Darkenss.CounterArrayLayout: 0x7fc464033960>
| | | | | | <Darkenss.DotView: 0x7fc461d7e190; baseClass = UICollectionViewCell; frame = (0 0; 40 40); hidden = YES; layer = <CALayer: 0x7fc461d7e530>>
| | | | | | | <UIView: 0x7fc461d7e550; frame = (0 0; 40 40); gestureRecognizers = <NSArray: 0x7fc461d7ed90>; layer = <CALayer: 0x7fc461d7e6b0>>
| | | | | | | | <UIImageView: 0x7fc461d7e370; frame = (0 0; 40 40); userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d7e510>>
| | | | | | <Darkenss.DotView: 0x7fc461d82250; baseClass = UICollectionViewCell; frame = (42 0; 40 40); hidden = YES; layer = <CALayer: 0x7fc461d821a0>>
| | | | | | | <UIView: 0x7fc461d825d0; frame = (0 0; 40 40); gestureRecognizers = <NSArray: 0x7fc461d82e10>; layer = <CALayer: 0x7fc461d82730>>
| | | | | | | | <UIImageView: 0x7fc461d82430; frame = (0 0; 40 40); userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d821c0>>
| | | | | | <Darkenss.DotView: 0x7fc461d86290; baseClass = UICollectionViewCell; frame = (0 41; 40 40); hidden = YES; layer = <CALayer: 0x7fc461d86610>>
| | | | | | | <UIView: 0x7fc461d86630; frame = (0 0; 40 40); gestureRecognizers = <NSArray: 0x7fc461d86e80>; layer = <CALayer: 0x7fc461d86790>>
| | | | | | | | <UIImageView: 0x7fc461d86470; frame = (0 0; 40 40); userInteractionEnabled = NO; layer = <CALayer: 0x7fc461d86240>>
| | | | | <UIImageView: 0x7fc464032fd0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x7fc464033170>>
| | <Darkenss.SmallCounterTrackerViewCell: 0x7fc461c90870; baseClass = UICollectionViewCell; frame = (0 53; 108 56); clipsToBounds = YES; alpha = 0; opaque = NO; layer = <CALayer: 0x7fc461c8f970>>
| | | <UIView: 0x7fc461c90a70; frame = (0 0; 188 96); gestureRecognizers = <NSArray: 0x7fc461eb1710>; layer = <CALayer: 0x7fc461c8fb30>>
| | | | <UIImageView: 0x7fc461c90bd0; frame = (4 4; 88 88); opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461c8fad0>>
| | | | <Darkenss.OffsetLabels: 0x7fc461c90eb0; frame = (96 4; 88 88); autoresize = RM+BM; layer = <CALayer: 0x7fc461ca0570>>
| | | | | <UITextView: 0x7fc462050200; frame = (0 0; 7 14); text = '10'; clipsToBounds = YES; userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x7fc461c92170>; layer = <CALayer: 0x7fc461c91af0>; contentOffset: {0, 0}; contentSize: {7, 55}>
| | | | | | <<_UITextContainerView: 0x7fc461c92c00; frame = (0 0; 7 55); layer = <_UITextTiledLayer: 0x7fc461c92dd0>> minSize = {0, 0}, maxSize = {1.7976931348623157e+308, 1.7976931348623157e+308}, textContainer = <NSTextContainer: 0x7fc461c918f0 size = (7.000000,340282346638528859811704183484516925440.000000); widthTracksTextView = YES; heightTracksTextView = NO>; exclusionPaths = 0x7fc461c00dc0; lineBreakMode = 0>
| | | | | | | <UITextSelectionView: 0x7fc461c95070; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x7fc461c94fb0>>
| | | | | <UITextView: 0x7fc462052000; frame = (0 0; 9 14); text = '10'; clipsToBounds = YES; userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x7fc461c99480>; layer = <CALayer: 0x7fc461c98df0>; contentOffset: {0, 0}; contentSize: {9, 55}>
| | | | | | <<_UITextContainerView: 0x7fc461c9a270; frame = (0 0; 9 55); layer = <_UITextTiledLayer: 0x7fc461c9a440>> minSize = {0, 0}, maxSize = {1.7976931348623157e+308, 1.7976931348623157e+308}, textContainer = <NSTextContainer: 0x7fc461c98bd0 size = (9.000000,340282346638528859811704183484516925440.000000); widthTracksTextView = YES; heightTracksTextView = NO>; exclusionPaths = 0x7fc461c00dc0; lineBreakMode = 0>
| | | | | | | <UITextSelectionView: 0x7fc461c9c750; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x7fc461c9c690>>
| | | | | <CAShapeLayer: 0x7fc461d7d7a0> (layer)
| | <UIImageView: 0x7fc461e44520; frame = (361.5 284; 2.5 7); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461e3f7f0>>
| <UIImageView: 0x7fc461fd19f0; frame = (3 292; 286 21); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461fd00c0>>
| <UIImageView: 0x7fc461fdbec0; frame = (289 292; 23 21); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461fdb6e0>>
| <UIImageView: 0x7fc461fe1540; frame = (312 292; 285 21); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fc461fd1b90>>
| <_UILayoutGuide: 0x7fc461fe6260; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7fc461fe5f50>>
| <_UILayoutGuide: 0x7fc461fe6cb0; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x7fc461fe5aa0>>
Update: I lost the hard drive that project was living on (but I have a backup that was only 45min old, so it'll all work out when I get a replacement...right? I have hope at least). However I have a very big clue.
I was calculating constraints and triggering layout in a KVO observer. This observer was triggering before the view had a superview. Skipping updates that happen before the view has a superview avoid this issue. Thinking about that a little more and:
'UIView-Encapsulated-Layout-Top' V:[UIView:0x7fc461fc6620]-(0)-|
Makes me think the -(0)- is "oh, and the view is zero height, thanks for playing" because said view has no superview and auto layout just doesn't want to deal with that mess.
Hopefully I can get the hardware back in working order early October and find out what is what!
Maybe you have forgotten to set translatesAutoresizingMaskIntoConstraints = NO for some view that you added programmatically on which you are using constraints. That might explain the AutoresizingMask. Kindly check.
UPDATE:
Also, for this constraint:
<NSLayoutConstraint:0x7fc461fe9110 UICollectionView:0x7fc463090000.top == UIView:0x7fc461fc6620.topMargin + 302>
try changing UIView:0x7fc461fc6620.topMargin to UIView:0x7fc461fc6620.top
I am guessing you haven't accounted for the margin while calculating your constant "302"
On IOS 5.1 I have added a container view to a viewcontroller on storyboard. I want to connect that container view via IBOutlet, so I can manage it easily on IB.
I have tried to use a regular UIView:
#property (nonatomic,weak) IBOutlet UIView *leftView; //connected this to container view on interface builder
then, if I use this, it doesn't work
[self.leftView addSubview:tableVC.view];
If I add a childview controller programmatically it works but it covers full screen of course.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
UIStoryboard* sb = [UIStoryboard storyboardWithName:#"MainStoryboard"
bundle:nil];
UITableViewController *tableVC = [sb instantiateViewControllerWithIdentifier:#"LogMasterViewController"];
[self.view addSubview:tableVC.view];
[self addChildViewController:tableVC];
[tableVC didMoveToParentViewController:self];
}
How can I connect container view to child view controller?
I just tested the following and it works fine:
- (void)viewDidLoad
{
[super viewDidLoad];
UIStoryboard* sb = [UIStoryboard storyboardWithName:#"MainStoryboard"
bundle:nil];
UITableViewController *tableVC = [sb instantiateViewControllerWithIdentifier:#"LogMasterViewController"];
[self.leftView addSubview:tableVC.view];
tableVC.view.frame = self.leftView.bounds;
[self addChildViewController:tableVC];
[tableVC didMoveToParentViewController:self];
}
A couple of thoughts:
If your LogMasterViewController is not a UITableViewController, but rather a view controller with a UITableView on it, you might want to make sure that you don't have autolayout or autosizing constraints on that tableview that make it resize the tableview to something that you can no longer see.
You might want to run the app, pause it after the app has finished presenting the screen (I put a breakpoint in viewDidAppear ... anything after that point should also work too, but don't do viewDidLoad or viewWillAppear) with the LogMasterViewController in self.leftView and then type the following command in the debugger console:
po [[UIWindow keyWindow] recursiveDescription]
You might want to give your leftView and the main view of LogMasterViewController unique tag numbers so you can more easily decipher the output. Anyway, use this recursiveDescription to identify whether the table view has been presented, but simply in a fashion so you cannot see the table, or whether it's not added at all. You can also confirm that your leftView (with its unique tag number, if you gave it one) is there, too.
(lldb) po [[UIWindow keyWindow] recursiveDescription]
$0 = 0x071a7a60 <UIWindow: 0x758e7a0; frame = (0 0; 320 480); autoresize = W+H; layer = <UIWindowLayer: 0x75ab340>>
| <UIView: 0x71a8480; frame = (0 20; 320 460); autoresize = RM+BM; tag = 1; layer = <CALayer: 0x71a84e0>>
| | <UIView: 0x71a8ce0; frame = (0 0; 160 460); autoresize = TM+BM; tag = 2; layer = <CALayer: 0x71a8510>>
| | | <UITableView: 0x7a9d400; frame = (0 0; 160 460); clipsToBounds = YES; opaque = NO; autoresize = W+H; tag = 3; gestureRecognizers = <NSArray: 0x71aba30>; layer = <CALayer: 0x71ab100>; contentOffset: {0, 0}>
| | | | <UITableViewCell: 0x71bbd50; frame = (0 396; 160 44); text = 'Row 10'; autoresize = W; layer = <CALayer: 0x71bbe80>>
| | | | | <UITableViewCellContentView: 0x71bbeb0; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71bc100>; layer = <CALayer: 0x71bbf10>>
| | | | | | <UILabel: 0x71bc1e0; frame = (10 0; 140 43); text = 'Row 10'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71bbd20>>
| | | | | <UIView: 0x71bc5c0; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71bb560>>
| | | | <UITableViewCell: 0x71bb5c0; frame = (0 352; 160 44); text = 'Row 9'; autoresize = W; layer = <CALayer: 0x71bb6f0>>
| | | | | <UITableViewCellContentView: 0x71bb720; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71bb970>; layer = <CALayer: 0x71bb780>>
| | | | | | <UILabel: 0x71bba50; frame = (10 0; 140 43); text = 'Row 9'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71bb590>>
| | | | | <UIView: 0x71bc560; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71bae50>>
| | | | <UITableViewCell: 0x71baeb0; frame = (0 308; 160 44); text = 'Row 8'; autoresize = W; layer = <CALayer: 0x71bafe0>>
| | | | | <UITableViewCellContentView: 0x71bb010; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71bb260>; layer = <CALayer: 0x71bb070>>
| | | | | | <UILabel: 0x71bb340; frame = (10 0; 140 43); text = 'Row 8'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71bae80>>
| | | | | <UIView: 0x71bc500; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71ba740>>
| | | | <UITableViewCell: 0x71ba7a0; frame = (0 264; 160 44); text = 'Row 7'; autoresize = W; layer = <CALayer: 0x71ba8d0>>
| | | | | <UITableViewCellContentView: 0x71ba900; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71bab50>; layer = <CALayer: 0x71ba960>>
| | | | | | <UILabel: 0x71bac30; frame = (10 0; 140 43); text = 'Row 7'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71ba770>>
| | | | | <UIView: 0x71bc4a0; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71ba030>>
| | | | <UITableViewCell: 0x71ba090; frame = (0 220; 160 44); text = 'Row 6'; autoresize = W; layer = <CALayer: 0x71ba1c0>>
| | | | | <UITableViewCellContentView: 0x71ba1f0; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71ba440>; layer = <CALayer: 0x71ba250>>
| | | | | | <UILabel: 0x71ba520; frame = (10 0; 140 43); text = 'Row 6'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71ba060>>
| | | | | <UIView: 0x71b8a70; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71b9910>>
| | | | <UITableViewCell: 0x71b9970; frame = (0 176; 160 44); text = 'Row 5'; autoresize = W; layer = <CALayer: 0x71b9aa0>>
| | | | | <UITableViewCellContentView: 0x71b9ad0; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71b9d20>; layer = <CALayer: 0x71b9b30>>
| | | | | | <UILabel: 0x71b9e00; frame = (10 0; 140 43); text = 'Row 5'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71b9940>>
| | | | | <UIView: 0x71b8010; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71b9200>>
| | | | <UITableViewCell: 0x71b9260; frame = (0 132; 160 44); text = 'Row 4'; autoresize = W; layer = <CALayer: 0x71b9390>>
| | | | | <UITableViewCellContentView: 0x71b93c0; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71b9610>; layer = <CALayer: 0x71b9420>>
| | | | | | <UILabel: 0x71b96f0; frame = (10 0; 140 43); text = 'Row 4'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71b9230>>
| | | | | <UIView: 0x71bb4f0; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71b8af0>>
| | | | <UITableViewCell: 0x71b8b50; frame = (0 88; 160 44); text = 'Row 3'; autoresize = W; layer = <CALayer: 0x71b8c80>>
| | | | | <UITableViewCellContentView: 0x71b8cb0; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71b8f00>; layer = <CALayer: 0x71b8d10>>
| | | | | | <UILabel: 0x71b8fe0; frame = (10 0; 140 43); text = 'Row 3'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71b8b20>>
| | | | | <UIView: 0x71bade0; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71b8090>>
| | | | <UITableViewCell: 0x71b80f0; frame = (0 44; 160 44); text = 'Row 2'; autoresize = W; layer = <CALayer: 0x71b8220>>
| | | | | <UITableViewCellContentView: 0x71b8250; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71b85a0>; layer = <CALayer: 0x71b82b0>>
| | | | | | <UILabel: 0x71b8790; frame = (10 0; 140 43); text = 'Row 2'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71b8630>>
| | | | | <UIView: 0x71ba6d0; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71b9fe0>>
| | | | <UITableViewCell: 0x71b4d30; frame = (0 0; 160 44); text = 'Row 1'; autoresize = W; layer = <CALayer: 0x71b4e80>>
| | | | | <UITableViewCellContentView: 0x71b4fb0; frame = (0 0; 160 43); gestureRecognizers = <NSArray: 0x71b5b80>; layer = <CALayer: 0x71b5040>>
| | | | | | <UILabel: 0x71b65d0; frame = (10 0; 140 43); text = 'Row 1'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x71b66e0>>
| | | | | <UIView: 0x71b98a0; frame = (0 43; 160 1); autoresize = W+TM; layer = <CALayer: 0x71bbca0>>
| | | | <UIImageView: 0x71ac5d0; frame = (0 453; 320 7); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0x71ac700>>
| | | | <_UITableViewSeparatorView: 0x71b3a90; frame = (0 483; 160 1); opaque = NO; autoresize = W; layer = <CALayer: 0x71b3b10>>
| | | | <_UITableViewSeparatorView: 0x71b3dd0; frame = (0 527; 160 1); opaque = NO; autoresize = W; layer = <CALayer: 0x71b3e30>>
| | | | <_UITableViewSeparatorView: 0x71b3e60; frame = (0 571; 160 1); opaque = NO; autoresize = W; layer = <CALayer: 0x71b3ec0>>
| | | | <_UITableViewSeparatorView: 0x71b3ef0; frame = (0 615; 160 1); opaque = NO; autoresize = W; layer = <CALayer: 0x71b3f50>>
| | | | <_UITableViewSeparatorView: 0x71b3f80; frame = (0 659; 160 1); opaque = NO; autoresize = W; layer = <CALayer: 0x71b3fe0>>
| | | | <_UITableViewSeparatorView: 0x71b4030; frame = (0 703; 160 1); opaque = NO; autoresize = W; layer = <CALayer: 0x71b4090>>
| | | | <UIImageView: 0x71ac810; frame = (153 541; 7 7); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0x71ac8b0>>
In this example, I gave my main view of my root controller a tag of "1", leftView has a tag of "2", and the main view of LogMasterViewController has a tag of "3". In this case, these show up as the second, third, and fourth lines of my output (and I also see my UITableViewCells listed below).
The "textboxes" that appear when clicking Tweet or Share for Twitter and Facebook. What are those made of? Can something similar be made? I am trying to customize them so that it will function as "comment" for a tableView. I'm talking of these two:
I am trying to make it say "Comment" instead of "Tweet" and "Facebook".. And then "Done" where it says "Send" and "Post". Any idea how/where I can create/customize these?
These are private view controllers. You can’t (well, shouldn’t) customize them—you’ll have to reimplement them yourself.
You can however, use the private method -recursiveDescription to get an idea of how the view hierarchy’s constructed. Create a simple app that shares some text using UIActivityViewController. Present it, pick Twitter or Facebook, then pause the app in the debugger. Type po [[[UIApplication sharedApplication] keyWindow] recursiveDescription] into the console to list the current view hierarchy.
EDIT: Ok, I was curious…
| <UIImageView: 0x75c7830; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x75c7890>>
| <UIView: 0x75c7900; frame = (0 20; 320 548); opaque = NO; autoresize = LM+W+RM+H; layer = <CALayer: 0x75c7960>>
| | <SLTwitterSheetCardView: 0x75b4950; frame = (-9 25; 337 188); opaque = NO; autoresize = W+H; layer = <CALayer: 0x75b4a40>>
| | | <UIView: 0x75c86b0; frame = (13 0; 311 188); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x75c8710>>
| | | | <UIImageView: 0x767b680; frame = (0 3; 311 184); clipsToBounds = YES; alpha = 0.75; opaque = NO; autoresize = W+TM+H; userInteractionEnabled = NO; layer = <CALayer: 0x767e4a0>>
| | | | <UIImageView: 0x7678a50; frame = (0 0; 311 188); opaque = NO; autoresize = W+H+BM; userInteractionEnabled = NO; layer = <CALayer: 0x767b8b0>>
| | | | <UIView: 0x75c8770; frame = (0 0; 311 188); autoresize = W+H; layer = <CALayer: 0x75c87d0>>
| | | | | <SLTwitterExpandedHitTestView: 0x767d950; frame = (6 155; 303 26); opaque = NO; autoresize = RM+TM; layer = <CALayer: 0x767da00>>
| | | | | | <SLTwitterExpandedHitTestImageView: 0x767ea60; baseClass = UIImageView; frame = (30 -6; 272 42); alpha = 0; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x767eb10>>
| | | | | | <SLTwitterExpandedHitTestButton: 0x767a4e0; baseClass = UIButton; frame = (5 5; 21 21); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x767a5a0>>
| | | | | | | <UIImageView: 0x7176770; frame = (0 0; 21 21); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x719cb70>>
| | | | | | | <UIButtonLabel: 0x767c680; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x767bbe0>>
| | | | | | <SLTwitterExpandedHitTestButton: 0x7193d10; baseClass = UIButton; frame = (120 7; 17 17); alpha = 0; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7193660>>
| | | | | | | <UIImageView: 0x7172000; frame = (0 0; 17 17); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x719da50>>
| | | | | | | <UIButtonLabel: 0x7194900; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x71949a0>>
| | | | | | <SLTwitterExpandedHitTestButton: 0x767d1a0; baseClass = UIButton; frame = (29 -1; 84 37); alpha = 0.8; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x767d260>>
| | | | | | | <UIButtonLabel: 0x767d580; frame = (0 9; 84 16); text = 'Add Location'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x767d620>>
| | | | <UIView: 0x7678160; frame = (0 0; 311 188); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x76781c0>>
| | | <UIImageView: 0x7680aa0; frame = (0 -34; 337 255); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x7680b00>>
| | | <UILabel: 0x75b4bb0; frame = (282 157; 29 29); text = '132'; clipsToBounds = YES; alpha = 0.7; opaque = NO; autoresize = LM+TM; userInteractionEnabled = NO; layer = <CALayer: 0x75b4c40>>
| | | <UIView: 0x75b5da0; frame = (14 41; 309 3); opaque = NO; autoresize = W+BM; layer = <CALayer: 0x75b5e00>>
| | | <UIButton: 0x75b33e0; frame = (20 7; 64 30); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x75b34a0>>
| | | | <UIImageView: 0x719c910; frame = (0 0; 64 30); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x716f230>>
| | | | <UIButtonLabel: 0x75b37d0; frame = (12 7; 40 15); text = 'Cancel'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x75b3870>>
| | | <UIButton: 0x75b3a60; frame = (265 7; 52 30); alpha = 0; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x75b3b20>>
| | | | <UIImageView: 0x767dc40; frame = (0 0; 52 30); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x76890a0>>
| | | | <UIButtonLabel: 0x75b3c20; frame = (6 7; 40 15); text = 'Cancel'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x75b3cc0>>
| | | <UIButton: 0x75b3ef0; frame = (263 7; 54 30); opaque = NO; autoresize = LM+BM; layer = <CALayer: 0x75b3fb0>>
| | | | <UIImageView: 0x768f4f0; frame = (0 0; 54 30); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x768eb60>>
| | | | <UIButtonLabel: 0x75b40e0; frame = (12 7; 30 15); text = 'Send'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x75b4180>>
| | | <UILabel: 0x75c6d40; frame = (139 5; 59 32); text = 'Tweet'; clipsToBounds = YES; opaque = NO; autoresize = W+BM; userInteractionEnabled = NO; layer = <CALayer: 0x75c6a10>>
| | | <UIView: 0x7191800; frame = (14 43; 311 112); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x71952a0>>
| | | | <UITextView: 0x8227400; frame = (0 0; 311 112); text = 'NSString'; opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x75b6ff0>; layer = <CALayer: 0x75b6990>; contentOffset: {-0, 10}>
| | | | | <UITextSelectionView: 0x75b6bf0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x75b6ca0>>
| | | | | <UIImageView: 0x75b71e0; frame = (0 105; 217 7); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0x75b7280>>
| | | | | <UIImageView: 0x75b7320; frame = (304 70; 7 37); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0x75b73c0>>
| | | | | <UIWebDocumentView: 0x8227800; frame = (0 0; 311 45); text = 'NSString'; opaque = NO; userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x75bc490>; layer = <UIWebLayer: 0x75bb0d0>>
| | | | | | <TileHostLayer: 0x75bb770> (layer)
| | | | | | | <TileLayer: 0x75c7270> (layer)
| | | | | <UITextSelectionView: 0x75c6220; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x75c62a0>>
| | | | | | <UIView: 0x75a09b0; frame = (75 9; 3 24); alpha = 0; userInteractionEnabled = NO; layer = <CALayer: 0x75bde40>>
| | | | | <UIView: 0x75b5f10; frame = (-1 41; 311 3); alpha = 0; opaque = NO; autoresize = W+BM; layer = <CALayer: 0x75b5f70>>
| | | | | <UIView: 0x8a6ebc0; frame = (0 -216; 313 1); opaque = NO; layer = <CALayer: 0x8a6e750>>
| | | | | <UIView: 0x8a6ec50; frame = (0 -188; 313 1); opaque = NO; layer = <CALayer: 0x8a6e600>>
| | | | | <UIView: 0x8a6e630; frame = (0 -160; 313 1); opaque = NO; layer = <CALayer: 0x8a6e690>>
| | | | | <UIView: 0x8a6e6c0; frame = (0 -132; 313 1); opaque = NO; layer = <CALayer: 0x8a6ecd0>>
| | | | | <UIView: 0x8a6ed00; frame = (0 -104; 313 1); opaque = NO; layer = <CALayer: 0x8a6ed60>>
| | | | | <UIView: 0x8a6ed90; frame = (0 -76; 313 1); opaque = NO; layer = <CALayer: 0x8a6edf0>>
| | | | | <UIView: 0x8a6ee20; frame = (0 -48; 313 1); opaque = NO; layer = <CALayer: 0x8a6ee80>>
| | | | | <UIView: 0x8a6ef10; frame = (0 -20; 313 1); opaque = NO; layer = <CALayer: 0x8a6eeb0>>
| | | | | <UIView: 0x8a6ef70; frame = (0 8; 313 1); opaque = NO; layer = <CALayer: 0x8a6efd0>>
| | | | | <UIView: 0x8a6f000; frame = (0 36; 313 1); opaque = NO; layer = <CALayer: 0x8a6f060>>
| | | | | <UIView: 0x8a6f090; frame = (0 64; 313 1); opaque = NO; layer = <CALayer: 0x8a6f0f0>>
| | | | | <UIView: 0x8a6f120; frame = (0 92; 313 1); opaque = NO; layer = <CALayer: 0x8a6f180>>
| | | | | <UIView: 0x8a6f1b0; frame = (0 120; 313 1); opaque = NO; layer = <CALayer: 0x8a6f210>>
| | | | | <UIView: 0x8a6f240; frame = (0 148; 313 1); opaque = NO; layer = <CALayer: 0x8a6f2a0>>
| | | <UIImageView: 0x75b5110; frame = (251 43; 79 34); alpha = 0; autoresize = LM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x75b5170>>
Basically, it’s what you’d expect: a bunch of background images, a label and buttons to fake the navigation bar style and a big text view for content.