TableView不显示没内容的Cell怎么办?

类似这种,我不想让下面那些空的显示.

很简单.

 self.tableView.tableFooterView = [[UIView alloc] init];

试过的都说好.

加完这句之后就变成了这样.

自定义了leftBarbuttonItem左滑返回手势失效了怎么办?

 self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
initWithImage:img
style:UIBarButtonItemStylePlain
target:self
action:@selector(onBack:)];
self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
 

ScrollView莫名其妙不能在viewController划到顶怎么办?

 self.automaticallyAdjustsScrollViewInsets = NO;
 

键盘事件写的好烦躁,都想摔键盘了,怎么办?

1.买个结实的键盘.

2.使用IQKeyboardManager(github上可搜索),用完之后腰也不疼了,腿也不酸了.

为什么我的app老是不流畅,到底哪里出了问题?

如图

这个神器叫做:KMCGeigerCounter,快去github搬运吧.

怎么在不新建一个Cell的情况下调整separaLine的位置?

 _myTableView.separatorInset = UIEdgeInsetsMake(, , , );
 

怎么点击self.view就让键盘收起,需要添加一个tapGestures么?

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.view endEditing:YES];
}
 

怎么给每个ViewController设定默认的背景图片?

使用基类啊,少年。

想在代码里改在xib里添加的layoutAttributes,但是怎么用代码找啊?

像拉button一样的拉你的约束.nslayoutattribute也是可以拉线的.

怎么像safari一样滑动的时候隐藏navigationbar?

 navigationController.hidesBarsOnSwipe = Yes
 

导航条返回键带的title太讨厌了,怎么让它消失!

 [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(, -)
forBarMetrics:UIBarMetricsDefault];
 

CoreData用起来好烦,语法又臭又长,怎么办?

MagicRecord

CollectionView 怎么实现tableview那种悬停的header?

CSStickyHeaderFlowLayou

能不能只用一个pan手势来代替UISwipegesture的各个方向?

 - (void)pan:(UIPanGestureRecognizer *)sender
{
typedef NS_ENUM(NSUInteger, UIPanGestureRecognizerDirection) {
UIPanGestureRecognizerDirectionUndefined,
UIPanGestureRecognizerDirectionUp,
UIPanGestureRecognizerDirectionDown,
UIPanGestureRecognizerDirectionLeft,
UIPanGestureRecognizerDirectionRight
};
static UIPanGestureRecognizerDirection direction = UIPanGestureRecognizerDirectionUndefined;
switch (sender.state) {
case UIGestureRecognizerStateBegan: {
if (direction == UIPanGestureRecognizerDirectionUndefined) {
CGPoint velocity = [sender velocityInView:recognizer.view];
BOOL isVerticalGesture = fabs(velocity.y) > fabs(velocity.x);
if (isVerticalGesture) {
if (velocity.y > ) {
direction = UIPanGestureRecognizerDirectionDown;
} else {
direction = UIPanGestureRecognizerDirectionUp;
}
}
else {
if (velocity.x > ) {
direction = UIPanGestureRecognizerDirectionRight;
} else {
direction = UIPanGestureRecognizerDirectionLeft;
}
}
}
break;
}
case UIGestureRecognizerStateChanged: {
switch (direction) {
case UIPanGestureRecognizerDirectionUp: {
[self handleUpwardsGesture:sender];
break;
}
case UIPanGestureRecognizerDirectionDown: {
[self handleDownwardsGesture:sender];
break;
}
case UIPanGestureRecognizerDirectionLeft: {
[self handleLeftGesture:sender];
break;
}
case UIPanGestureRecognizerDirectionRight: {
[self handleRightGesture:sender];
break;
}
default: {
break;
}
}
break;
}
case UIGestureRecognizerStateEnded: {
direction = UIPanGestureRecognizerDirectionUndefined;
break;
}
default:
break;
}
}
 

拉伸图片的时候怎么才能让图片不变形?
1.UIImage *image = [[UIImage imageNamed:@"xxx"] stretchableImageWithLeftCapWidth:10 topCapHeight:10];

2.


怎么播放GIF的时候这么卡,有没有好点的库?

FlipBoard出品的太适合你了:https://github.com/Flipboard/FLAnimatedImage

怎么一句话添加上拉刷新?

https://github.com/samvermette/SVPullToRefresh

 [tableView addPullToRefreshWithActionHandler:^{
// prepend data to dataSource, insert cells at top of table view
// call [tableView.pullToRefreshView stopAnimating] when done
} position:SVPullToRefreshPositionBottom];
 

怎么把tableview里cell的小对勾的颜色改成别的颜色?

 _mTableView.tintColor = [UIColor redColor];
 

本来我的statusbar是lightcontent的,结果用UIImagePickerController会导致我的statusbar的样式变成黑色,怎么办?

 - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
 

怎么把我的navigationbar弄成透明的而不是带模糊的效果?

 [self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
 

怎么改变uitextfield placeholder的颜色和位置?

继承uitextfield,重写这个方法

 - (void) drawPlaceholderInRect:(CGRect)rect {
[[UIColor blueColor] setFill];
[self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];
}
 

你为什么知道这么多奇怪的花招?

去stackoverflow刷问题啊,少年!

原文地址:http://www.cocoachina.com/ios/20141231/10783.html

iOS开发的一些奇巧淫技的更多相关文章

  1. iOS开发的一些奇巧淫技(转载)

    iOS开发的一些奇巧淫技 http://www.cocoachina.com/ios/20141229/10783.html iOS开发的一些奇巧淫技2 http://www.cocoachina.c ...

  2. iOS开发的一些奇巧淫技2

    能不能只用一个pan手势来代替UISwipegesture的各个方向? - (void)pan:(UIPanGestureRecognizer *)sender { typedef NS_ENUM(N ...

  3. octave之奇巧淫技向量化计算实现寻找样本点所属聚类下标

    前面有文章提到过,K-means算法,第一步骤是找出样本点的的所属聚类.下面用两种方式实现,一种是普通的循环,一种是完全向量化计算. 假设 : X 是m×n样本矩阵,其每一行是一个样本,m表示样本数目 ...

  4. LLDB奇巧淫技

    打印视图层级 这个相信很多人都会了,是ta是ta就是ta recursiveDescription 用法大概就是如下 123 po [self.view recursiveDescription] p ...

  5. [异常解决] 奇巧淫技——VirtualBox中的linux无显示启动,并在win7上远程控制

    楼主是资深技术宅(癖),由于感觉手上的老笔记本太卡,遂狠心买了个性能至强的主机同时配了个投影仪(满足躺着打代码的意淫场景).但是体验了大概一个月发现还是坐着打代码舒服,但是如下图坐着打代码总是要抬头看 ...

  6. C基础 那些年用过的奇巧淫技

    引言 - 为寻一颗明星 为要寻一颗明星 徐志摩 1924年12月1日<晨报六周年纪念增刊> 我骑著一匹拐腿的瞎马, 向著黑夜里加鞭:—— 向著黑夜里加鞭, 我跨著一匹拐腿的瞎马.// 我冲 ...

  7. 介绍一个C++奇巧淫技

    你能实现这样一个函数吗:   MyType type;   HisType htype;   serialize_3(11, type, htype);   serialize_4(type, hty ...

  8. Windows的奇巧淫技(为什么GIF显示不出来??)

    谁的电脑里没点小秘密?东藏西藏到最后自己都找不到了有木有?今天教大家个隐藏文件的高招: 将任意文件隐藏到图片中!怎么样?再也不用建什么「马列主义哲学」的文件夹啦!

  9. iOS开发常见BUG和一些小技巧(ps:耐心看完,很实用)

    [385][scrollView不接受点击事件,是因为事件传递失败] // // MyScrollView.m // Created by beyond on 15/6/6. // Copyright ...

随机推荐

  1. 获取机器安装.NET版本的几种方式

    当调查应用程序问题时,通常需要先确认目标机器所安装的 .NET Framework 的版本.可以通过如下方式来确认版本号: 通过控制面板安装程序查询 通过查询注册表获取版本信息 通过查看安装目录获取版 ...

  2. Unity3D入门之Unity3D介绍以及编辑器的使用(1)

    1.Unity3D介绍 Unity3D是跨平台(IOS.Android.Windows Phone.Windows.Flash.XBOX360.PS3.Wii等)游戏引擎,可以开发2D.2.5D.3D ...

  3. Linux 通配符

    概述 本章节主要介绍关于linux通配符的用法,熟练运用通配符可以提高工作效率并且可以简化一些繁琐的处理步骤. 正文 测试数据 touch a a6.log abc.log ac.txt b c c5 ...

  4. [异常解决] JTAG 与STM32的SWD连接接线方式

    如果我们的板子上只留了4个接口:V3.3,SWDIO,SWDCLK,GND.那么和JTAG的连接关系参见下图: dd400cf22b5c01e57a6c9e198d5383a0_189.jpg (0 ...

  5. linux下进程间通信

    信号 信号是进程间相互传递消息的一种方法,只是用来通知某进程发生了什么事件,并不给进程传递任何数据. #include <sys/types.h> #include <unistd. ...

  6. jq里延迟对象Deferred,状态变化后,会一直保持

    var defer = $.Deferred(); defer.resolve('abc'); defer.done(function (data) { console.log(data); }) d ...

  7. vue初体验:实现一个增删查改成绩单

    前端变化层出不穷,去年NG火一片,今年react,vue火一片,ng硬着头皮看了几套教程,总被其中的概念绕晕,react是faceback出品,正在不断学习中,同时抽时间了解了vue,查看了vue官方 ...

  8. Atitti 图像处理 图像混合 图像叠加 blend 原理与实现

    Atitti 图像处理 图像混合 图像叠加 blend 原理与实现 混合模式 编辑 本词条缺少信息栏,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧! 混合模式是图像处理技术中的一个技术名词,不 ...

  9. salesforce 零基础学习(二十二)Test简单使用

    本篇内容只是本人简单的mark开发中常出现的一些疑问,方便后期项目使用时奠定基础,如果对Test零基础童鞋,欢迎查看Test官方的使用介绍: https://help.salesforce.com/a ...

  10. Java面试(3)-- Java关系运算符

    class Demo03{ public static void main(String[] args){ //关系运算符 == //例1 int a = 10; int b = 10; double ...