Mac Cocoa |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jan 14, 2009 9:41 pm Post subject: Views & View Controllers |
|
|
iphonedevbook.com - Tab Bar with Switch Views
"I've created a TabBar project with three views. I want the SwitchViews to be
one of my views. I've managed to incorporate a button in the switch views
project instead of the toolbar, very easy. I've incorporated two other different
views in the project as views 2 and 3 but can't seem to incorporate the Switch-
Views as view 1." |
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Jan 24, 2009 4:03 pm Post subject: |
|
|
iphonedevbook - Using a method in a different file. Obj-C Question
"It's a lot simpler to use one of apple's root controllers. Navigation bar, tab
bar and so on. But this is for when you do not want any visible controller to
remain on the screen." |
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Apr 06, 2009 10:01 pm Post subject: |
|
|
Matt Gallagher - Recreating UITableViewController to increase code reuse
"I'll show you what UITableViewController does by recreating its functionality
on top of UIViewController and show you why doing this can provide a richer
base controller class that you can use throughout your iPhone application." |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Wed Sep 23, 2009 6:13 pm Post subject: |
|
|
so - Get Position of UIView within entire UIWindow
"I need to determine the position of the UIView in the entire 320x480 co-
ordinate system. For example, if the UIView is in a UITableViewCell it's
position within the window could change dramatically irregardless of the
superview." |
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Jul 04, 2010 3:15 am Post subject: |
|
|
iphonedevsdk.com - Put something behind a translucent status bar?
"I am trying to more or less re-create the built-in Photos app functionality
as part of my app. What I am stuck on right at this moment is getting a full
screen image to show up behind a translucent status bar." |
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Oct 14, 2010 7:41 pm Post subject: |
|
|
MF - Popping Modal UINavigationController
"I have a separate XIB file containing a UINavigationController. It's in a se-
parate XIB so it can be loaded and displayed from a number of different po-
ints in my app." |
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
 |
XNote Kapetan
Joined: 16 Jun 2006 Posts: 537
|
Posted: Thu Dec 20, 2012 1:34 pm Post subject: |
|
|
so - Presenting a view controller in Universal app, iOS 4 to 6
Code: | @interface MasterViewController ()
@property (nonatomic, retain) UIPopoverController *popoverController;
- (void)presentViewController:(UIViewController *)viewController origin:(id)origin;
@end
@implementation MasterViewController
@synthesize popoverController;
- (void)presentViewController:(UIViewController *)viewController origin:(id)origin {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]) {
[self presentViewController:viewController animated:NO completion:nil];//iOS 5 and above
} else {
[self presentModalViewController:viewController animated:NO]; //iOS 4, deprecated in iOS 6
}
} else {
if (!self.popoverController) {
self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:viewController] autorelease];
} else {
[self.popoverController setContentViewController:viewController];
}
if(![self.popoverController isPopoverVisible]) {
if([origin isKindOfClass:[UIBarButtonItem class]]) {
[self.popoverController presentPopoverFromBarButtonItem:origin
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[self.popoverController presentPopoverFromRect:CGRectZero inView:origin permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
}
}
@end |
|
|
Back to top |
|
 |
XNote Kapetan
Joined: 16 Jun 2006 Posts: 537
|
Posted: Thu Dec 20, 2012 2:05 pm Post subject: |
|
|
so - dismissViewControllerAnimated:completion: method not working
"This should work for you. Check it."
Code: | MainController *mainController = (MainController *)self.parentViewController;
[self dismissViewControllerAnimated:YES completion:^{
[mainController aMethod];
}]; |
|
|
Back to top |
|
 |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jul 30, 2014 5:37 pm Post subject: |
|
|
github.com - RKSwipeBetweenViewControllers
"Swipe between ViewControllers like in the Spotify or Twitter app with an
interactive Segmented Control in the Navigation Bar"
 |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Mon Mar 02, 2020 9:48 pm Post subject: |
|
|
sarun - How to create a new Xcode project without Storyboard
"When you create a new project in Xcode, the default boilerplate includes the
Main.storyboard. If you are going with a no storyboard approach and want to
set everything up in code, there are a few steps you need to do." |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Fri Jul 03, 2020 8:29 pm Post subject: |
|
|
so - Set UIViewController view property to custom UIView class without storyboard
"You can override this method in order to create your views manually. If you
choose to do so, assign the root view of your view hierarchy to the view
property. The views you create should be unique instances and should not be
shared with any other view controller object. Your custom implementation of
this method should not call super." |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Sat Jul 04, 2020 3:49 pm Post subject: |
|
|
so - Get to UIViewController from UIView?
Code: | @interface UIView (FindUIViewController)
- (UIViewController *) firstAvailableUIViewController;
- (id) traverseResponderChainForUIViewController;
@end
@implementation UIView (FindUIViewController)
- (UIViewController *) firstAvailableUIViewController {
// convenience function for casting and to "mask" the recursive function
return (UIViewController *)[self traverseResponderChainForUIViewController];
}
- (id) traverseResponderChainForUIViewController {
id nextResponder = [self nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return nextResponder;
} else if ([nextResponder isKindOfClass:[UIView class]]) {
return [nextResponder traverseResponderChainForUIViewController];
} else {
return nil;
}
}
@end |
|
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Fri Jun 17, 2022 9:06 am Post subject: |
|
|
r - Any good sources to learn how to build UI programmatically?
"The Let's Build That App site has tons of good tutorial videos. He usually
follows a programmatic approach. He has paid courses, but quite a few of
the standalone videos are free. The paid courses are quite good." |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Mon Jun 19, 2023 10:32 pm Post subject: |
|
|
sarunw - How to create a new Xcode project without Storyboard
"When you create a new project in Xcode, the default boilerplate includes the
Main.storyboard. If you are going with a no storyboard approach and want to
set everything up in code, there are a few steps you need to take." |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Mon Aug 07, 2023 7:39 pm Post subject: |
|
|
so - Setting NSScrollView Contents to Top Left Instead of Bottom Left When Document Swapping
"Although isFlipped is subclassing the custom view in Interface Builder, the
documentView is getting replaced on the view swap, the first of which gets
used on awakeFromNib."
Code: |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
_window = [[[NSApplication sharedApplication] windows] firstObject];
} |
|
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Thu Sep 28, 2023 6:40 pm Post subject: |
|
|
r - ViewController Life Cycle
"Unlocking the Magic of iOS App Development: Discover the ViewController
Life Cycle" |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Tue Jan 23, 2024 10:03 am Post subject: |
|
|
adc - rootViewController
"If the window has an existing view hierarchy, the old views are removed
before the new ones are installed."
This tidbit wasted my whole day.
It used to work ok if I set the root view controller after adding a navigation
or tab controller as a subview to a main window up until transition from iOS
12 to iOS 13 but then my apps stopped receiving -viewWillAppear: and
viewDidAppear: on -pushViewController:animated: or when the view popped
back.
As I was trying to resurrect an older project nothing seemed to work. All the
views were messed up, especially on bezel-less phones like iPhone X and
newer.
Googling found that people don't have these called for various reasons even
before iOS 13 but nothing helped. Then at some point I changed this code:
Code: | [self.window addSubview:self.navController.view];
[self.window makeKeyAndVisible];
[self.window setRootViewController:self.navController]; // TOO LATE
|
to this:
Code: | [self.window setRootViewController:self.navController];
[self.window addSubview:self.navController.view];
[self.window makeKeyAndVisible];
|
The reason I did that was not because I realised that setting a root view
controller will have the old views [...] removed before the new ones
are installed.
No. I was getting this warning in the console: "Unbalanced calls to begin/end
appearance transitions for <UINavigationController...>" even after I removed
everything from the view, like commenting out all the cone in -viewDidLoad.
It was driving me crazy and I moved the call to -setRootViewController: in
an attempt to silence this warning. And when I did it everything started to
behave as it should. It was like magic, or iOS 12  |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Tue Feb 13, 2024 6:05 pm Post subject: |
|
|
r - New API viewIsAppearing seems inconsistent with legacy funcs
"To know if a VC is being displayed from a push for the first time (contrary
to being re-displayed following a pop childVC), we have the VC variable
isMovingToParent which is set to true." |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
Posted: Mon Aug 12, 2024 10:01 am Post subject: |
|
|
so - shouldAutorotateToInterfaceOrientation not being called in iOS 6
"UIInterfaceOrientation is a property of UIApplication and only contains 4
possibilities which correspond to the orientation of the status bar.
DO NOT CONFUSE IT WITH
UIDeviceOrientation which is a property of the UIDevice class, and contains 7
possible values" |
|
Back to top |
|
 |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3208 Location: Europe
|
|
Back to top |
|
 |
|