连接wifi页面UI
This commit is contained in:
@@ -8,7 +8,11 @@
|
||||
|
||||
#import "ConnectHotpotViewController.h"
|
||||
|
||||
@interface ConnectHotpotViewController ()
|
||||
@interface ConnectHotpotViewController ()<UITextFieldDelegate>
|
||||
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
|
||||
@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *dashView;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *pwdTf;
|
||||
@property (weak, nonatomic) IBOutlet UIView *containerView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -17,21 +21,59 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"热点连接";
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keybordframeChanged:) name:UIKeyboardDidChangeFrameNotification object:nil];
|
||||
for (UIImageView *view in self.dashView) {
|
||||
view.backgroundColor = [UIColor clearColor];
|
||||
view.image = [self imageWithLineWithSize:view.frame.size];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
- (UIImage *)imageWithLineWithSize:(CGSize)size{
|
||||
CGFloat width = size.width;
|
||||
UIGraphicsBeginImageContext(size);
|
||||
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
|
||||
CGFloat lengths[] = {10,5};
|
||||
CGContextRef line = UIGraphicsGetCurrentContext();
|
||||
CGContextSetStrokeColorWithColor(line, [UIColor colorWithRed:133/255.0 green:133/255.0 blue:133/255.0 alpha:1.0].CGColor);
|
||||
CGContextSetLineDash(line, 0, lengths, 1);
|
||||
CGContextMoveToPoint(line, 0, 1);
|
||||
CGContextAddLineToPoint(line, width-10, 1);
|
||||
CGContextStrokePath(line);
|
||||
return UIGraphicsGetImageFromCurrentImageContext();
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)keybordframeChanged:(NSNotification *)no {
|
||||
NSDictionary *userInfo = no.userInfo;
|
||||
|
||||
// 动画的持续时间
|
||||
double duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
|
||||
// 键盘的frame
|
||||
CGRect keyboardF = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
keyboardF = [self.view convertRect:keyboardF fromView:self.view];
|
||||
CGRect containerViewF = [self.view convertRect:self.containerView.frame fromView:self.scrollView];
|
||||
|
||||
CGFloat miniSpacing = 4;
|
||||
|
||||
CGFloat offset = CGRectGetMaxY(containerViewF) + miniSpacing - CGRectGetMinY(keyboardF);
|
||||
if (offset <= 0) {
|
||||
offset = 0;
|
||||
}
|
||||
[UIView animateWithDuration:duration animations:^{
|
||||
self.scrollView.contentInset = UIEdgeInsetsMake(-offset, 0, 0, 0);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user