创建iPhone锁定划动条的方法

iPhone关闭屏幕后可以自动锁定。下面的代码可以创建一个这样的划动条。

iphone-lock-bar.png

代码如下:

1. #import <telephonyui /TelephonyUI.h>
2.
3. TPBottomLockBar* lockBar = [ [ TPBottomLockBar alloc ] initWithFrame:CGRectMake(0.0f, 340.0f, 320.0f, 100.0f) knobColor:1];
4.
5. [lockBar setLabel:@"Slide To Unlock"];
6. [lockBar setFontSize: 14];
7. [lockBar setDelegate: self];
8. [contentView addSubview: lockBar];
9. [lockBar startAnimating];
10.
11. </telephonyui>

创建之后如果要获取解锁,可以重载unlock方法

1. - (void)unlock
2. {
3.
4. //do something
5.
6. }


返回:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License