2011-10-20 71 views
1

其實我只能用向上和向下箭頭顯示動作表。在我看來,我有不同的專欄。現在的問題是,當我點擊第一列,它顯示行動表向上方向,但中間的行動表,它表明第二列,所以我需要移動左側的箭頭。調整iPad應用中UIActionsheet的箭頭方向

我從下面的代碼管理這個事情。但我無法在最後一列的右側移動箭頭。

float x=offset.x; 
float y=offset.y; 
float w=newPop.frame.size.width; 
float h=newPop.frame.size.height; 
if(offset.x < 150) 
{ 
    x = 160; 
    w = w-180; 
} 
else if(offset.x > 600) 
{ 
    x= 600; 
    //w= w+180; 
} 

CGRect myImageRect = CGRectMake(x, y, w, h); 


[newPop showFromRect:myImageRect inView:_calDay animated:YES]; 

我通過降低其寬度管理箭頭的上左方向。但不能用它調整它的正確方向。

讓我知道,如果你有這方面的任何解決方案。請檢查下面的快照,我管理和離開的方向,但我需要和正確的方向。

enter image description here

+0

UIActionSheet?不是UIPopOverController? – Jake

+0

是的,我正在顯示UIActionsheet與新的API可用從3.2 showFromRect顯示actiosheet看起來像一個popover。 –

回答

1

我的建議是採取一種觀點認爲,在它的actionsheet。
負載,在像這樣的酥料餅查看....

NSSet *allTouches = [event allTouches]; 
UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; 
CGPoint p = [touch locationInView:self.view]; 


if(popoverController) 
    [popoverController dismissPopoverAnimated:YES]; 

popOverController *obj_popOverController = [[popOverController alloc] initWithNibName:@"popOverController" bundle:nil]; 
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:obj_popOverController]; 
popoverController = [[UIPopoverController alloc] initWithContentViewController:navController]; 
[popoverController setPopoverContentSize:CGSizeMake(320.0, 320.0)]; 
[popoverController presentPopoverFromRect:CGRectMake(p.x, p.y, 10, 10) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown animated:YES]; 
[navController release];