美文网首页
投机取巧

投机取巧

作者: 毛茸茸的我总念成橡皮虾 | 来源:发表于2015-10-23 21:41 被阅读116次

1、更改textField的clearButton样式

UIButton *clearButton = [_nameTextField valueForKey:@"_clearButton"];

[clearButton setImage:[UIImage imageNamed:@"emotionstore_progresscancelbtn.png"] forState:UIControlStateNormal];

2、更改textField的placehoder的字体颜色

[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];

3、延迟执行

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

});

4、获取每个tableViewCell中的按钮点击

- (void)clickButton:(UIButton *)button event:(id)event {

NSSet *touches = [event allTouches];

UITouch *touch = [touches anyObject];

CGPoint currentTouchPosition = [touch locationInView:self.tableView];

NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:currentTouchPosition];

if (indexPath != nil) {

}

}

5、更改字符串属性和字体

NSString *string = @"123ABC456";

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];

[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange:(3,3)];//更改 ABC 字符颜色为红色

[attributedString addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:15] range:NSMakeRange:(6,3)];//更改 456 字符字体大小为15号字体

6、更改 tableView 分割线颜色和长度

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {

[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 20, 0, 20)];

[self.tableView setSeparatorColor:[UIColor colorWithRed:0.89f green:0.89f blue:0.89f alpha:1.00f]];

}

if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {

[self.tableView setLayoutMargins:UIEdgeInsetsMake(0, 20, 0, 20)];

[self.tableView setSeparatorColor:[UIColor colorWithRed:0.89f green:0.89f blue:0.89f alpha:1.00f]];

}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {

[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 20, 0, 20)];

[self.tableView setSeparatorColor:[UIColor colorWithRed:0.89f green:0.89f blue:0.89f alpha:1.00f]];

}

if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {

[self.tableView setLayoutMargins:UIEdgeInsetsMake(0, 20, 0, 20)];

[self.tableView setSeparatorColor:[UIColor colorWithRed:0.89f green:0.89f blue:0.89f alpha:1.00f]];

}

}

相关文章

  • 工作

    不能投机取巧

  • 投机取巧

    2018年6月5日 星期二 天气:晴 今天在大宝身上发生了一件前所未有的 大事情! 大宝:(兴高采烈...

  • 投机取巧

    文/林若兰 在二〇一二年的年终会结束时,李站长说:“为了感谢渔业协会里的代表们对我们工作的大力支持,今晚我和...

  • 投机取巧

    1、更改textField的clearButton样式 UIButton *clearButton = [_nam...

  • 投机取巧

    文/四棵胡杨 魑魅魍魉 目无王法

  • 投机取巧

    每天凑够一百字的意义在哪里,维持日更,分散精力给这种事情上,虽然写作能力确实是有恢复的迹象,实际上却对现实没有显而...

  • 投机取巧

    晚上刷牙的时候突然想起很早以前看到的一个“励志”故事。大意是说,一家做牙膏的企业,业绩下滑很厉害,老板们把大伙召集...

  • 投机取巧

    机会永远是留给有准备的人,或许抵挡不住欲望的侵蚀,可能我们可以用勤劳的双手打造锋刃的利剑撕开遮挡馅饼的天空,让他准...

  • 投机取巧

    在此,首先要感谢007这个平台,通过这个写作群让我有机会把生活中的点点滴滴,和这几年的人生轨迹都一一记录了下来。 ...

  • 投机取巧

    刚来简书,写出的文字几乎没有人读,所以,我就想出了投机取巧的方法。 把文章最精彩的地方,做为文章的标题,那篇...

网友评论

      本文标题:投机取巧

      本文链接:https://www.haomeiwen.com/subject/uoithttx.html