views:

92

answers:

1

i'm trying to get a tab bar effect not unlike russel quinn's 'creative review' app. the tabbar swipes across, which i have figured out, but the tabbar style itself is unlike anything i've seen on the iphone (though it looks so simple!).

it has square buttons with a space between, and each button has a select/active/inactive state. i'm having a hard time seeing how this can be tabbar, but i don't know any other way. can someone explain this?

here's the example :: http://bit.ly/c8CeBC.

any help is appreciated.

EDIT ::

thanks to yukla for the guidance, i got it working using uibutton. pretty basic and fairly embarrassing that i couldn't think this up... in my rootviewcontroller.m, i tossed this in after i synthesized homeBtn.

- (UIButton *) homeBtn {
    homeBtn = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
    homeBtn.frame = CGRectMake(0, 0, 100, 45);
    [homeBtn setTitle:@"Home" forState:UIControlStateNormal];
    [homeBtn setTitle:@"Home" forState:UIControlStateSelected];
    [homeBtn setBackgroundImage:[UIImage imageNamed:@"normal.png"] forState:UIControlStateNormal];
    [homeBtn setBackgroundImage:[UIImage imageNamed:@"disabled.png"] forState:UIControlStateDisabled];
    [homeBtn setBackgroundImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateSelected];
    [homeBtn setBackgroundImage:[UIImage imageNamed:@"highlighted.png"] forState:UIControlStateHighlighted];
    [homeBtn setBackgroundImage:[UIImage imageNamed:@"highlighted+selected.png"] forState:(UIControlStateHighlighted | UIControlStateSelected)];
    [homeBtn addTarget:self action:@selector(switchPages:) forControlEvents:UIControlEventTouchUpInside];

    return homeBtn;
}

just subclass it to uiswipeview and all set.

A: 

how about a scroll view with buttons instead of a tab bar?? you can have different image/background for normal/selected/disabled state. but then you'll have to write your own code for loading the different views.

lukya
thanks mate. i actually got the answer from the source (russel quinn, creative review app). he said what he did was make each button just a UIView. the backgroundColor property is set in response to the regular touchesBegan, touchesEnded, etc. methods. then just create a bunch of those and put them inside a UIScrollView.agreed though, i'll definitely need to write my own code to load different views, but that's not terribly difficult. thanks for the quick response!
Chunjai