`

UITableView & UITextField

 
阅读更多
keyboard event
----------------------
    float version = [[[UIDevice currentDevice] systemVersion] floatValue];
   
    if (version >= 5.0)
    {
        [[NSNotificationCenter defaultCenter] addObserver:[AppProperty sharedInstancd]
                                                 selector:@selector(keyboardWillShow:)
                                                     name:UIKeyboardWillChangeFrameNotification
                                                   object:nil];
    }


get keyboard height
----------------------

    NSDictionary *userInfo = [notification userInfo];
    NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
    CGFloat height = [aValue CGRectValue].size.height;


contentInset & scroll
----------------------

    UITableView *table = (UITableView *)[self superview];
    NSIndexPath *indexPath = [table indexPathForCell:self];
   
   
    CGFloat height = [[AppProperty sharedInstancd] keyboardHeight];
    table.contentInset =  UIEdgeInsetsMake(0, 0, height, 0);
   
    [table scrollToRowAtIndexPath:indexPath
                 atScrollPosition:UITableViewScrollPositionBottom
                         animated:YES];


UITableViewCellReorderControl  滑块
UITableViewCellDeleteConfirmationControl  删除
-----------------------
            if([[[view class] description] isEqualToString:@"UITableViewCellReorderControl"])
            {
                UIView* resizedGripView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetMaxX(view.frame), CGRectGetMaxY(view.frame))];
                [resizedGripView addSubview:view];
                [self addSubview:resizedGripView];
               
               
                CGSize sizeDifference = CGSizeMake(resizedGripView.frame.size.width - view.frame.size.width, resizedGripView.frame.size.height - view.frame.size.height);
                CGSize transformRatio = CGSizeMake(resizedGripView.frame.size.width / view.frame.size.width, resizedGripView.frame.size.height / view.frame.size.height);
               
                // Original transform
                CGAffineTransform transform = CGAffineTransformIdentity;
               
                // Scale custom view so grip will fill entire cell
                transform = CGAffineTransformScale(transform, transformRatio.width, transformRatio.height);
               
                // Move custom view so the grip's top left aligns with the cell's top left
                transform = CGAffineTransformTranslate(transform, -sizeDifference.width / 2.0, -sizeDifference.height / 2.0);
               
                [resizedGripView setTransform:transform];
               
                for(UIImageView* cellGrip in view.subviews)
                {
                    if([cellGrip isKindOfClass:[UIImageView class]])
                        [cellGrip setImage:nil];
                   
                   
                }
            }


UITableViewCellReorderControl  滑块
-----------------------
        for (UIView * view in self.subviews)
        {
            if ([NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound)
            {
                for (UIView * subview in view.subviews)
                {
                    if ([subview isKindOfClass: [UIImageView class]])
                    {

                        ((UIImageView *)subview).image = nil;

                    }
                }
            }
        }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics