Giter Club home page Giter Club logo

Comments (30)

KieranLafferty avatar KieranLafferty commented on June 29, 2024

What is the behaviour when you do this? Although you are using the control to organize your UINavigationControllers, the behaviour of the navigation controllers will not change as a result of being contained within the KLNoteViewContoller.

I would attempt to do it using the method call rather than the accessor. i.e. try
[self.navigationItem setLeftBarButtonItem: nil animated: YES/NO];

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

The behaviour - nothing happens. i tried
[self.navigationItem setLeftBarButtonItem: nil animated: YES/NO];
nothing happens.

The problem, that if i set action on button within view:
-(void)DeleteLeftItem:(id)sender {
[self updateUI];
}
and press this button, leftbaritem will be removed, but when i call updateUI in noteviewcontroller delegate, nothing happens.

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Have you put a breakpoint to see if the code is being executed?

On 2013-02-27, at 11:37 AM, Kirill Kunst [email protected] wrote:

The behaviour - nothing happens. i tried
[self.navigationItem setLeftBarButtonItem: nil animated: YES/NO];
nothing happens.

The problem, that if i set action on button within view:
-(void)DeleteLeftItem:(id)sender {
[self updateUI];
}
and press this button, leftbaritem will be removed, but when i call updateUI in noteviewcontroller delegate, nothing happens.


Reply to this email directly or view it on GitHub.

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

Ofcause, the code executed, but nothing happens.

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

i tried set navbar title in updateUI, but I did not get

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Ah I think I know what is wrong

you need to do

self.navigationController.navigationItem.leftBarButtonItem = nil;

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

otherwise check fi self.navigationItem is nil or not to see if you are actually referencing anything

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

i tried self.navigationController.navigationItem.leftBarButtonItem = nil;
nothing happens.

and i check self.navigationItem is nill or not - it's not nil.

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

Can you try to add 3-4 viewcontrollers to klnoteviewcontroller and update title or right or left bar item when viewcontrollers go to KLControllerCardStateDefault state?
Maybe i do anything wrong.

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

tbh this is a navigationcontroller issue not related to the control. As mentioned previously the control just organizes UIViewControllers, what you do with the UIViewControllers/UINavigationControllers is up to you. Try performing the same operation with the UINavigationController outside of the control and see if it works

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

Try performing the same operation with the UINavigationController outside of the control and see if it works
I try to change nav item title and rightbaritem from uibutton action and everything is ok.
but when i try to do this in
-(void) noteViewController: (KLNoteViewController_) noteViewController didUpdateControllerCard:(KLControllerCard_)controllerCard toDisplayState:(KLControllerCardState) toState fromDisplayState:(KLControllerCardState) fromState {}, nothing happens,unfortunately

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Try

if (toState == KLControllerCardStateDefault) {
NSIndexPath path = [self indexPathForControllerCard:controllerCard];
TDListViewController viewController = (TDListViewController *)[self noteView:self viewControllerForRowAtIndexPath:path];
viewController.navigationController.navigationItem.leftBarButtonItem= nil;
}

}

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

just throwing out ideas... :P

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

i tried that :) unfortunately, nothing happens

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

try performing [noteView reloadDataAnimated:NO]; after the change

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Using a break poing check if the line :

TDListViewController viewController = (TDListViewController *)[self noteView:self viewControllerForRowAtIndexPath:path];

is actually returning a TDListViewController and not a UINavigationController

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Just a note as well, in the code:

NSIndexPath path = [self indexPathForControllerCard:controllerCard];
TDListViewController viewController = (TDListViewController *)[self noteView:self viewControllerForRowAtIndexPath:path];
viewController.navigationController.navigationItem.leftBarButtonItem= nil;

you need a * after NSIndexPath and TDListViewController

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

i understand

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

TDListViewController viewController = (TDListViewController *)[self noteView:self viewControllerForRowAtIndexPath:path];

it's return me right TDListViewController with right variables

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

try performing [noteView reloadDataAnimated:NO]; after the change
if (toState == KLControllerCardStateDefault) {
NSIndexPath *path = [self indexPathForControllerCard:controllerCard];
TDListViewController *viewController = (TDListViewController *)[self noteView:self viewControllerForRowAtIndexPath:path];
viewController.navigationController.navigationItem.leftBarButtonItem= nil;
viewController.navigationItem.leftBarButtonItem= nil;
[self reloadDataAnimated:NO];
}

if i run this code, i have exception:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[_PFArray objectAtIndex:]: index (2147483647) beyond bounds (2)'

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Note you can also get the uiNavigationController reference by simply doing controllerCard.navigationController

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

Maybe the problem in my

  • (UIViewController )noteView:(KLNoteViewController)noteView viewControllerForRowAtIndexPath:(NSIndexPath *)indexPath {

    //Initialize a blank uiviewcontroller for display purposes
    UIStoryboard st = [UIStoryboard storyboardWithName:[[NSBundle mainBundle].infoDictionary objectForKey:@"UIMainStoryboardFile"] bundle:[NSBundle mainBundle]];
    TDListViewController
    viewController = [st instantiateViewControllerWithIdentifier:@"ListRootViewController"];
    viewController.list = self.listsData[indexPath.row];
    //Return the custom view controller
    return viewController;
    }

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

You need to have * after UIStoryboard and TDListViewController. You are initializign a pointer

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

Be sure you understand what the * actually means in the context of assignment

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

you must be getting warnings for that no?

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

I understand, i paste this piece of code from xcode, but in xcode i have * when it's nessesary, but there * are hidden. So strange

from klnoteviewcontroller.

KieranLafferty avatar KieranLafferty commented on June 29, 2024

ahhh ok I thought you were just not using them and was wondering how it was even working :P

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

If I did not have *, my code won't be compiled

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

I try a dirty hack. i add viewController property to KLControllerCard.
@Property (nonatomic, strong) UIViewController* viewController;

And in reloadData add:
UIViewController* viewController = [self noteView:self viewControllerForRowAtIndexPath:[NSIndexPath indexPathForRow:count inSection:0]];

    UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];

    KLControllerCard* noteContainer = [[KLControllerCard alloc] initWithNoteViewController: self
                                                                                navigationController: navigationController
                                                                                               index:count];

// i add this line
noteContainer.viewController = viewController;

And now in
-(void) noteViewController: (KLNoteViewController_) noteViewController didUpdateControllerCard:(KLControllerCard_)controllerCard toDisplayState:(KLControllerCardState) toState fromDisplayState:(KLControllerCardState) fromState {
if (toState == KLControllerCardStateDefault) {
[((TDListViewController *)controllerCard.viewController) updateUI];
}

}

from klnoteviewcontroller.

leoru avatar leoru commented on June 29, 2024

Do you think it looks like a patch to your component? :P

from klnoteviewcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.