[英]Ios app icon class
是否有與主屏幕上的應用程序圖標對應的 UI class?
或者某種類似的按鈕,也有擺動效果的方法?
簡短的回答,不。
開發人員可以使用 SDK 重新創建這些效果。 使用圖像(應用程序圖標)制作自定義 UIButton 非常簡單。 然后只需添加適當的長按手勢處理即可激活按鈕的可編輯狀態並開始擺動。
-(void)viewDidLoad {
// make a UIButton
UIButton *myWiggleButton = [UIButton buttonWithType:UIButtonTypeCustom];
// set an image for the button
[myWiggleButton setImage:[UIImage imageNamed:@"my_app_image.png"] forState:UIControlStateNormal];
// add an action and target for the button
[myWiggleButton addTarget:self action:@selector(myButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
// finally add a long touch gesture recognizer
UILongPressGestureRecognizer *longPressGesture =
[[[UILongPressGestureRecognizer alloc]
initWithTarget:self action:@selector(startWiggleMode:)] autorelease];
[myWiggleButton addGestureRecognizer:longPressGesture];
}
-(void)startWiggleMode:(UIGestureRecognizer*)recognizer
{
// start a wiggling animation for the button.
// add a UIButton for the 'x' on top of the wiggling button
}
-(void)myButtonTapped:(id)sender
{
// handle button tap case here.
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.