Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if( [bottomButtons count] != 0 )
- {
- NSMutableArray * newArray = [[[NSMutableArray alloc] init] autorelease];
- for( NSInteger i = [bottomButtons count] - 1; i >= 0; i-- )
- {
- [newArray addObject:[bottomButtons objectAtIndex:i]];
- }
- float startY = 0.0 + ( CAFF_POPUP_SHADOW_PADDING + CAFF_POPUP_PADDING + CAFF_POPUP_ARROW_HEIGHT );
- float startX = 0.0 + ( CAFF_POPUP_SHADOW_PADDING + CAFF_POPUP_PADDING + CAFF_POPUP_ARROW_HEIGHT );
- float startHeight = 0;
- float buttonWidth = view ? [view frame].size.width : width;
- NSInteger counter = 0;
- for( id button in newArray )
- {
- if( [button isKindOfClass:[UIPopoverViewButtonSeperator class]] )
- {
- startY += CAFF_POPUP_BOTTOM_BUTTON_SEPERATOR_MARGIN;
- if( [(UIPopoverViewButtonSeperator *)button indent] )
- {
- [button setFrame:NSMakeRect( CAFF_POPUP_SHADOW_PADDING + CAFF_POPUP_ARROW_HEIGHT, startY, buttonWidth + ( CAFF_POPUP_PADDING * 2 ), CAFF_POPUP_BOTTOM_BUTTON_SEPERATOR_HEIGHT)];
- [bgView addSubview:button];
- }
- startY += CAFF_POPUP_BOTTOM_BUTTON_SEPERATOR_HEIGHT + ( CAFF_POPUP_BOTTOM_BUTTON_SEPERATOR_MARGIN * 2 );
- startHeight += ( CAFF_POPUP_BOTTOM_BUTTON_SEPERATOR_HEIGHT + CAFF_POPUP_BOTTOM_BUTTON_SEPERATOR_MARGIN * 2 ) + CAFF_POPUP_PADDING;
- if( lastButtonRow != -1 )
- {
- startY += [previousButton frame].size.height + CAFF_POPUP_PADDING;
- startHeight += [previousButton frame].size.height + CAFF_POPUP_PADDING;
- previousButton = nil;
- lastButtonRow = -1;
- }
- counter++;
- continue;
- }
- float buttonHeight;
- switch( [(UIPopoverViewButton *)button UISize] )
- {
- case UIPopoverSizeLarge :
- buttonHeight = CAFF_POPUP_BOTTOM_BUTTON_LARGE_HEIGHT;
- break;
- case UIPopoverSizeNormal :
- buttonHeight = CAFF_POPUP_BOTTOM_BUTTON_NORMAL_HEIGHT;
- break;
- case UIPopoverSizeSmall :
- buttonHeight = CAFF_POPUP_BOTTOM_BUTTON_SMALL_HEIGHT;
- break;
- }
- if( [button row] != -1 )
- {
- lastButtonRow = [button row];
- previousButton = button;
- NSInteger index = 0;
- NSInteger countRow = [self buttonRowCountForButton:button
- index:&index];
- float cellWidth = ceil( buttonWidth / [self buttonRowCountForButton:button
- index:&index] ) - ( CAFF_POPUP_PADDING / ( countRow - 1 ) ) - ( CAFF_POPUP_PADDING / ( countRow - 1 ) );
- [button setFrame:NSMakeRect( ceil( startX + ( cellWidth * index ) + ( CAFF_POPUP_PADDING * index ) ), startY, ceil( cellWidth ), buttonHeight )];
- [bgView addSubview:button];
- if( counter == ( [bottomButtons count] - 1 ) )
- {
- startY += [previousButton frame].size.height + CAFF_POPUP_PADDING;
- startHeight += [previousButton frame].size.height + CAFF_POPUP_PADDING;
- }
- } else {
- if( [button row] != lastButtonRow )
- {
- lastButtonRow = [button row];
- startY += [previousButton frame].size.height + CAFF_POPUP_PADDING;
- startHeight += [previousButton frame].size.height + CAFF_POPUP_PADDING;
- }
- [button setFrame:NSMakeRect( startX, startY, buttonWidth, buttonHeight )];
- [bgView addSubview:button];
- startY += [button frame].size.height + CAFF_POPUP_PADDING;
- startHeight += [button frame].size.height + CAFF_POPUP_PADDING;
- }
- counter++;
- }
Add Comment
Please, Sign In to add comment