sonsongithub/PopupView

How can we do it using segmentbar?

Closed this issue · 4 comments

How can we do it using segmentbar?

I don't have any good idea.

We get to know segmentbar's frame if we want to use SNPopupView on UISegmentBar.
But Apple does not provide the way to know it, we can't do it.
I think that Apple has to provide it.

So, if we want to do it, we have to investigate the frame of UISegmentBar' button by a prior knowledge.

ya got your point sir....

still i m trying to do it by a trick that is on selection of segement index it will call uibarbutton automatically.... may b i dnt kwn exactly but i m trying this...

- (IBAction)pushButton:(id)sender {
    DNSLogMethod
    if (popup == nil) {
        popup = [[SNPopupView alloc] initWithContentView:testContentView contentSize:CGSizeMake(200, 120)];
    }
    [popup presentModalFromBarButtonItem:sender inView:self.view animated:NO];
    [popup addTarget:self action:@selector(didTouchPopupView:)];
    [popup release];
    [popup setDelegate:self];       
    [tablePopup reloadData];
}


-(IBAction) segmentedControlIndexChanged{
    UIBarButtonItem *item;
    switch (self.segmentedControl.selectedSegmentIndex) {
        case 0:
            item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:self action:@selector(pushButton:)];    
            [item.target performSelector:item.action];

            break;
        case 1:
            break;
        default:
            break;
    }

}

Sorry, I modified your code format.

OK, but "presentModalFromBarButtonItem:inView:animated:" includes a private method...
Someone knows how to avoid using the private method...?