Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Views & View Controllers

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa
Mac Cocoa  
Author Message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jan 14, 2009 9:41 pm    Post subject: Views & View Controllers Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat Jan 24, 2009 4:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Apr 06, 2009 10:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Wed Sep 23, 2009 6:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Jul 04, 2010 3:15 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Oct 14, 2010 7:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jul 25, 2011 11:57 pm    Post subject: Reply with quote

so - Fullscreen UIView with Status bar and Navigation Bar overlay
on the top


"Just set “wants fullscreen layout” in your view controller. That solves the
problem for me."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Nov 02, 2011 1:25 am    Post subject: Reply with quote

so - How may I define the “Group table view” pattern as
background programmaticaly?


"I think everything is in the title Smile"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sat Jun 09, 2012 1:37 am    Post subject: Reply with quote

so - UIButton: how to center an image and a text using imageEdgeInsets and titleEdgeInsets?

"First, configure the text of titleLabel (because of styles, i.e, bold, italic, etc).
Then, use setTitleEdgeInsets considering the width of your image"
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Thu Dec 20, 2012 1:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Thu Dec 20, 2012 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jul 30, 2014 5:37 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Fri Dec 01, 2017 10:36 pm    Post subject: Reply with quote

so - 'Application windows are expected to have a root view controller at the end of application launch' error when running a project with Xcode 7, iOS 9

"Thank you very much . the answer is in the error message: 'Application
windows' I find there is two window in my project ,one is normal widdow,
the other is a third party modual called."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Wed Oct 09, 2019 7:45 pm    Post subject: Reply with quote

so - Is it not possible to create a UIViewController programmatically without building the view?

"I want to create a UIViewController programmatically. No nibs or storyboards.
It will basically be created and then presented, and in its own class it will set up
an image to be displayed."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Mar 02, 2020 9:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Fri Jul 03, 2020 8:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Sat Jul 04, 2020 3:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Fri Jun 17, 2022 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Jun 19, 2023 10:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Aug 07, 2023 7:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Thu Sep 28, 2023 6:40 pm    Post subject: Reply with quote

r - ViewController Life Cycle

"Unlocking the Magic of iOS App Development: Discover the ViewController
Life Cycle"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Tue Jan 23, 2024 10:03 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Tue Feb 13, 2024 6:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group