xcode6按照ios开发一五一十复制原代码,结果iphonexcode 模拟器器还是没有声音

xcode升级到6之后无法运行程序,因为只能选择iOS Device,模拟器都不见了,在Preference里面下载7.1的模拟器,可是还是没出现选项 - 开源中国社区
当前访客身份:游客 [
当前位置:
已经整整折腾了两天了,还是没解决,急求。
共有7个答案
<span class="a_vote_num" id="a_vote_num_
我之前也遇到过,如果scheme没有弄错的话,你重启一下Mac,看会不会有效,具体原因我也不知道,可以更新Xcode6没有完全完成。
<span class="a_vote_num" id="a_vote_num_
点击performence里面 可以下载模拟器!答案最佳!
<span class="a_vote_num" id="a_vote_num_
hi~~哥们解决了么?我也有同样的问题,折腾很久了也没解决,重装重启的试过n次
<span class="a_vote_num" id="a_vote_num_
/ihojin/p/xcode-missing-simulators.html
<span class="a_vote_num" id="a_vote_num_
<span class="a_vote_num" id="a_vote_num_
貌似 没遇到过。
<span class="a_vote_num" id="a_vote_num_
在 window devices 里创建模拟器
更多开发者职位上
有什么技术问题吗?
类似的话题当前位置: >
Swift编程语言 Xcode 6 Beta全新的iOS模拟器
作者:集落
当Obejective-C without C,新编程语言Swift到来之时,苹果也在其开发者中心放出了Xcode 6 Beta版。而最吸引眼球的一点莫过于Xcode 6增加了一个全新的iOS模拟器,允许开发者根据设备调整应用尺寸,除了&Resizable iPhone&和&Resizable iPad&之外,还包括iPhone 5/5S、iPad 2/Retina/Air等具体设备。除此之外,Xcode 6还有哪些新特性?让我们一起来看一下吧。
完全支持Swift编程
Xcode 6为开发者引入了一种全新的设计和开发应用的方式,深度支持Swift编程,开发者不仅能使用100%的Swift代码来创建一款崭新的应用,还可以向已存在的应用添加Swift代码或框架,并在Swift或Objective-C中查看文档。诸如&Jump to Definition&、&Open Quickly&等在Swift中均能很好地工作,甚至Objective-C的头定义在Swift语法中也能良好地呈现。
实时的代码效果预览
现在,开发者在使用Interface Builder设计界面时,能够实时地预览代码效果。当程序运行时,自定义对象将在设计时展现。当开发者修改自定义视图代码时,Interface Builder的设计画布则会自动更新,而无需任何的构建和运行操作。
此外,其所包含的API还支持向IB Inspector添加参数来快速修改视图,甚至开发者还可以预先填充示例数据视图来让界面更加准确。而支持UIKit大小类的iOS脚本则能够让开发者为所有iOS设备开发单一的通用脚本,不仅能为特定的设备尺寸或方向进行行为选择,还可以保持接口的一致性,且易于维护。
新增View Debugging功能
Xcode 6实现了此前备受开发者期待的View Debuger。现在,调试应用UI就像单击那样简单,开发者可以轻而易举地看到为什么一个视图可能会被裁剪或隐藏,并在Inspector中检查和调试约束及其他参数。当然,Xcode还包含了其他新的调试工具,比如调试Gauge来监控I/O用法、增强版的iCloud Gauge等,而Debug Navigator也将显示更有用的信息,包括栈框架记录和块队列等。
18183手游网发布此文仅为传递信息,不代表18183认同其观点或证实其描述。
最新最全的独家礼包、游戏资讯
还有各种活动、八卦等你来!
扫描二维码或搜索微信号:sylt_18183
果断关注涨姿势吧!
热门iPhone游戏
新游期待榜
热门手游榜Swift开发教程--Xcode6在iPhone模拟器上编译上下留有黑块问题
问题解决:在项目配置页,General下面有一栏App Icons and Launch Images,其中有一项Launch Images Source,如果你遇到了问题,那么旁边显示的可能是一个按钮,Use Asset Catalog,点一下然后确定就可以了,会在项目中的Images.xcassets中生成LaunchImage,就像Xcode5中那样。此时再运行程序,已经不会再有上下的黑边问题了。但为了更好的用户体验,做张图片放进去吧。当然,在iOS8中依然会加载LaunchScreen.xib,看来至少二者是可以共存的。问题延伸:如果你想删掉这套启动图,仅仅是删除Images.xcassets中的LaunchImage是不行的,还要在项目配置,Build Settings中找到Asset Catalog Launch Image Set Name(搜索asset可以帮你快速定位到这项),把后面的&#20540;删掉。否则编译都通不过,会报错Images.xcassets: None of the input catalogs contained a matching launch image set named &LaunchImage&。
最新教程周点击榜
微信扫一扫iOS开发中遇到的一些问题及解决方案
【385】【scrollView不接受点击事件,是因为事件传递失败】
// MyScrollView.m
// Created by beyond on 15/6/6.
// Copyright (c) 2015年
All rights reserved.
// 不一定要用继承,可以使用分类
#import MyScrollView.h
#import CoView.h
@implementation MyScrollView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
if(!self.dragging)
UITouch *touch = [touches anyObject];
CGPoint loc = [touch locationInView:self];
// x y转成coView中的坐标
CGFloat x = loc.x - 10;
CoView *coView = (CoView *)[self viewWithTag:5267];
CGFloat y = loc.y - coView.y;
CGPoint newLoc = [coView convertPoint:loc fromView:self];
// 经过验证:x == newLoc.x y == newLoc.y
x = newLoc.x;
y = newLoc.y;
// 现在就是通过point 算出 row,col,进而的推算出i
int col = x/(kBtnWH+kBtnMarginH);
int row = y/(kBtnWH+kBtnMarginV);
int i = row*kBtnColumnNum +
[[self nextResponder] touchesBegan:touches withEvent:event];
// 注意,coView处理的时候,i越界的情况要处理;i从0开始
DLog(@--点了第%d个---,i);
[coView btnTouched:i];
[super touchesBegan:touches withEvent:event];
//NSLog(@MyScrollView touch Began);
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
if(!self.dragging)
[[self nextResponder] touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
【382】【带暂停和继续的NSTimer】
@interface NSTimer (Pause)
@property (nonatomic, strong, readwrite) NSString *
///////////////////////////////////////////////////////////////////////////
#import NSTimer+Pause.h
static void *state = (void *)@
@implementation NSTimer (Pause)
-(void)pause
if (![self isValid]) {
[self setFireDate:[NSDate distantFuture]]; //如果给我一个期限,我希望是 00:00:00 +0000
-(void)resume
if (![self isValid]) {
[self setFireDate:[NSDate date]];
- (NSString *)state
return objc_getAssociatedObject(self, state);
- (void)setState:(NSString *)s
objc_setAssociatedObject(self, state, s, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
【381】【给分类添加属性】
// Declaration
@interface MyObject (ExtendedProperties)
@property (nonatomic, strong, readwrite) id myCustomP
@end Implementation
static void * MyObjectMyCustomPorpertyKey = (void *)@MyObjectMyCustomPorpertyK
@implementation MyObject (ExtendedProperties)
- (id)myCustomProperty
return objc_getAssociatedObject(self, MyObjectMyCustomPorpertyKey);
- (void)setMyCustomProperty:(id)myCustomProperty
objc_setAssociatedObject(self, MyObjectMyCustomPorpertyKey, myCustomProperty, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
【367】【评论提示后返回】
[SVProgressHUD showSuccessWithStatus:@提交成功];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[blockSelf.navigationController popViewControllerAnimated:YES];
【365】【每一组的最新记录:分组之前 先排序】
select max(FTime),* FROM DynamicInfoTable WHERE FUID = &#39;d441e1d7-e-4b3232&#39; group by FOrgID,FType order by max(FTime) DESC
【363】【label文字左边距】
UIView *leftview = [[UIView alloc] initWithFrame:frame];
textField.leftViewMode = UITextFieldViewModeA
textField.leftView = //imageView
【362】【返回之前,必须退出键盘】【#pragma mark - 返回提示 // 返回,由于是发布页面,所以要检查 提示 防止误操作 - (void)back:(id)sender { BOOL hasSomething = [self formHasSomething]; if (hasSomething) { // 提示 // 发送请求,删除 UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@温馨提示 message:@您确定要放弃发布并返回吗? delegate:nil cancelButtonTitle:@取消 otherButtonTitles:@确定, nil]; alertView.confirmBlock = ^(){ // 调用父类的返回 [super back:sender]; }; [alertView show]; }else{ [self.view endEditing:YES]; [super back:sender]; } }】
【358】【3G4G自动图片】
#import UIImageView+Download.h
// 异步下载图片
#import UIImageView+WebCache.h
#import KLNetworkStatus.h
#import KLTools.h
@implementation UIImageView (Download)
- (void)downloadImgWithUrlString:(NSString *)urlString placeHolderImgName:(NSString *)placeHolderImgName
if (!(urlString.length & 0)) {
//没有图片,直接使用默认图
self.image = [UIImage imageNamed:placeHolderImgName];
NSURL *url = [NSURL URLWithString:urlString];
// 1.先从缓存中取,如果缓存中有:直接设置
SDWebImageManager *manager = [SDWebImageManager sharedManager];
BOOL isImgAlreadyExists = [manager cachedImageExistsForURL:url];
if (isImgAlreadyExists) {
UIImage *image = [manager.imageCache imageFromDiskCacheForKey:urlString];
[self setImage:image];
// 2.如果缓存中没有,如果是WIFI,下载
BOOL isWifi = [[KLNetworkStatus sharedKLNetworkStatus] isReachableViaWifi];
if (isWifi) {
[self sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:placeHolderImgName]];
// 3.如果是3G/4G,则要再进行判断用户是否开启了 自动下载
BOOL isWWAN = [[KLNetworkStatus sharedKLNetworkStatus] isReachableViaWWAN];
if (isWWAN) {
BOOL isAllowDownload = [KLTools isNetworkDownloadSet];
if (isAllowDownload) {
[self sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:placeHolderImgName]];
【348】【判断是否安装weixin】
[WXApi isWXAppInstalled]方法无效
使用下面这个
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@weixin://]])
NSLog(@OK weixin://);
【347】【导航标题】【self.navigationItem.title = @发布;】
【346】【xib中的cell无故多出一个半透明灰灰的40高、300宽的label,通过po打印,发现是两个label,猜测是contentLabel和detailLabel】
产生原因:是由于在xib选择了一次cell的accessory为detail,结果 在xib代码中 添加了两个label,
因此,即使 再次将accessory选择为no,那两个label依然在xib代码中。。。。
(lldb) po self
(lldb) po self.contentView
; layer = &
(lldb) po [self.contentView subviews]
&__NSArrayM 0x6ffb850&(
【345】【正则,表情匹配{:001:}对应的是@\{:\d\d\d:\},注意括号都要转义】
@\{:\d\d\d:\}反解析 表情文字
+(NSString *) FContentPrettyFaceText:(NSString *)faceText
NSString *str = faceT
NSString *pattern = @\{:\d\d\d:\};
NSError *error = NULL;
//定义正则表达式
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
//使用正则表达式匹配字符
NSArray *arr = [regex matchesInString:str options:0 range:NSMakeRange(0, [str length])];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@facesDic.plist ofType:nil]];
if (arr.count != 0)
for (long i = arr.count - 1; i &= 0; i--) {
NSTextCheckingResult *result = arr[i];
NSRange range = [result range];
// 开始位置比如:9
int loc = range.
// 长度固定是 7
int len = range.
// {:067:}
NSString *subStr = [str substringWithRange:range];
NSString *key = [subStr substringWithRange:NSMakeRange(2, 3)];
// key:067
NSString *value = [dict objectForKey:key];
NSString *head = [str substringToIndex:loc];
NSString *tail = [str substringFromIndex:loc + len];
str = [NSString stringWithFormat:@%@%@%@,head,value,tail];
【343】【奇怪的bug】
问题描述:
1、tableView是通过IB,并且有自动布局;
2、headView是通过代码创建的
3、给tableView加headView,没有问题
4、给tableView加footerView,当用代码创建时,也没有问题
5、但是:当footerView是用自动布局时,tableView首次展示时,footView高度为0;
但是,当jump到一个控制器,并且再次返回时,tableView再次显示,此时footView高度正常了。。。
问题原因:
猜测是:tableView的自动布局影响的
解决方法:
当前 想到的是:线程延迟几秒再给tableView设置footView
self.tableView.tableHeaderView = self.headV
_footerView = [RowView RowView];
// 这里加个延迟,不然会高度为0,应该是自动布局导致的问题
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)),dispatch_get_main_queue(), ^{
kStrongSelf
strongSelf.tableView.tableFooterView = _footerV
[UIView animateWithDuration:5 animations:^{
[strongSelf.view layoutIfNeeded];
[strongSelf.tableView layoutIfNeeded];
【342】【只要约束改变后,就要手动刷新对应的view】
_topView.bigImgHeightConstraint.constant = 0;
[UIView animateWithDuration:0.3 animations:^{
[self.view layoutIfNeeded];
[_topView layoutIfNeeded];
【340】【IB控件用weak,String用copy,delegate用weak,block用copy,对象类型用Strong,基本类型用assign】
@property (nonatomic,weak) IBOutlet UILabel *
- (IBAction)xxxBtnClicked:(UIButton *)
【335】【label图文混排CBEmotionView】【 使用core text 和 core graphics 实现的文字与表情图片的并排绘制】
【334】【Localizable.strings】
// Localizable.strings
本地资源文件
// Created by beyond on 15/3/19.
// Copyright (c) 2015年 beyond. All rights reserved.
appName=XXX;
login_now=立即登录;
vip_showmsg=请联系您孩子的班主任开通VIP服务;
NSString *str = NSLocalizedString(@vip_showmsg, nil);
UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:str delegate:self cancelButtonTitle:@关闭 destructiveButtonTitle:@购买VIP otherButtonTitles:@联系客服, nil];
[sheet showInView:self.view];
【333】【禁用单个页面手势滑动返回功能】
在有的时候,我们不需要手势返回功能,那么可以在页面中添加以下代码:
- (void)viewDidAppear:(BOOL)animated
[super viewDidAppear:animated];
// 禁用 iOS7 返回手势
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
- (void)viewWillDisappear:(BOOL)animated
[super viewWillDisappear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
#define KLNavigationBarHidden [self.navigationController setNavigationBarHidden:YES animated:YES];
#define KLNavigationBarShow [self.navigationController setNavigationBarHidden:NO animated:YES];
【332】【反斜杠】
在吗 NSString 如何表示反斜杠呀
NSString *path = @
打一个错误, 和&挨一起就出错,打两个 NSString *path = @main\;可以,但是后面
[path appendString @d盘];以后,
实际的path内容为main\d盘 怎么弄一个单反斜杠呀??
NSString *str = [NSString stringWithFormat:@%@\%@,@main,@d盘];
NSLog(@str:%@,str);
我发现了,这是个显示的问题,在Debuger Console里可以正常显示,在调试中却显示成两个斜杠,转意字符应该是好使的,即NSString中,\,就是 一个 的转意字符,和c的和c++的一样,只是调试时显示的值有bug罢了。
【331】【data--&string--&OC对象】
(lldb) po data
&7b65 223a5 de794 a8e688b7 e4b88de5 ad98e59c a8e6e7 a081e994 99e8afaf efbc36f 6e7a6e 756c6c7d&
(lldb) po responseString
{StatusCode:500,ErrorMessage:用户不存在或密码错误!,Content:null}
14:26:31.952 JZH[161:60b] __70-[NetRequest initWithAction:userId:password:otherParam:completeBlock:]_block_invoke [Line 209] responseObject ==== {
Content = ;
ErrorMessage = Ue0dU5b58Ubc6UbefUff01;
StatusCode = 500;
【330】【label中显示表情】【查看原文】
【327】【金额用NSNumber接收,必须strong引用 否则 内存释放,崩掉】
@property (nonatomic,strong) NSNumber *orderP
double currentPrice = [model.FCurrentPrice doubleValue];
_topView.currentLabel.text = [NSString stringWithFormat:@¥%.02lf,currentPrice];
【326】【xcode6建分类】【左上角file菜单---》new File----&Objective-c File----&Category】
【325】【通知】
- (void)xxxNoti:(NSNotification *)noti
//获取键盘的高度
NSDictionary *dict = [noti userInfo];
- (void)dealloc
[[NSNotificationCenter defaultCenter]removeObserver:self];
// 监听支付成功
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(paySuccess) name:@notificationCenter_paySuccess object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@notificationCenter_paySuccess object:nil];
【324】【webview死活不执行js代码】
webview加载本地html需要时间,同时,通过id向服务器获取详情也需要时间,因此:很可能当服务器已经获取到detail信息时,本地的html尚未加载完毕,故出现上述情况
【323】【UIAlertView+Block】
typedef void (^UIAlertViewBlock)(UIAlertView *alertView, NSInteger buttonIndex);
typedef void (^ConfirmBlock)(void);
@interface UIAlertView(Block)
@property (nonatomic,copy)ConfirmBlock confirmB
@property (nonatomic,copy)UIAlertViewBlock clickB
// 必须手动用运行时绑定方法
- (void)setConfirmBlock:(ConfirmBlock)confirmB
- (ConfirmBlock)confirmB
- (void)setClickBlock:(UIAlertViewBlock)clickB
- (UIAlertViewBlock)clickB
@end====================
#import UIAlertView+Block.h
@implementation UIAlertView(Block) 必须手动用运行时绑定方法
- (void)setConfirmBlock:(ConfirmBlock)confirmBlock
objc_setAssociatedObject(self, @selector(confirmBlock), confirmBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
if (confirmBlock == NULL) {
self.delegate =
self.delegate =
- (ConfirmBlock)confirmBlock
return objc_getAssociatedObject(self, @selector(confirmBlock));
必须手动用运行时绑定方法
- (void)setClickBlock:(UIAlertViewBlock)clickBlock
objc_setAssociatedObject(self, @selector(clickBlock), clickBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
if (clickBlock == NULL) {
self.delegate =
self.delegate =
- (UIAlertViewBlock)clickBlock
return objc_getAssociatedObject(self, @selector(clickBlock));
#pragma mark - UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
if (buttonIndex == 1) {
if (self.confirmBlock) {
// self.confirmBlock(self, buttonIndex);
self.confirmBlock();
// 取消或其他
if (self.clickBlock) {
self.clickBlock(self, buttonIndex);
@end====================
// 发送请求,删除
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@温馨提示 message:@您确定要放弃发布并返回吗? delegate:nil cancelButtonTitle:@取消 otherButtonTitles:@确定, nil];
alertView.confirmBlock = ^(){
// 调用父类的返回
[super doBack:sender];
[alertView show];
【322】【按钮,左图 右文字】
#import OperationBtn.h
#define kMargin 5
@implementation OperationBtn
- (void)setHighlighted:(BOOL)highlighted
// do nothing 就是取消默认的高亮状态
- (CGRect)imageRectForContentRect:(CGRect)contentRect
// 图片等宽高(15,整个按钮是25,图片左上边距全是5)
CGFloat wh = contentRect.size.height - kMargin - kM
CGRect rect = CGRectMake(kMargin, kMargin, wh, wh);
- (CGRect)titleRectForContentRect:(CGRect)contentRect
// 文字居右 (图片15*15)
CGFloat wh = contentRect.size.height - kMargin - kM
CGFloat x = kMargin + 15 + 3;
CGFloat y = kMargin + 3;
CGRect rect = CGRectMake(x, kMargin,contentRect.size.width - x, wh);
- (void) setEnabled:(BOOL)enabled
DLog(@setEnabled方法:%d,enabled );
[super setEnabled:enabled];
【321】【No matching provisioning profiles found】
问题:Your build settings specify a provisioning profile with the UUID &dedebf56-8f41-4af9-aeb8-5ec59fe02fedbeyond&, however, no such provisioning profile was found. Xcode can resolve this issue by downloading a new provisioning profile from the Member Center.
解决方法:
targets---build settings---- code signing----provisioning profile----debug
【320】【自动布局按钮排列】【先全部与父类对齐,然后设置一下乘积因子】【查看原文】
【315】【webview执行js函数注意事项】
url has prefix 判断时,要注意ios统一加http://并且注意大小写哦~~~
字符串参数要用单引号
true用数字1
并且jsonString必须使用NSJSONReadingMutableLeaves,
不能使用pretty风格,如下所示:
NSData *data = [NSJSONSerialization dataWithJSONObject:bigDict options:NSJSONReadingMutableLeaves error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
【314】【奇怪的问题】【在cell的xib文件中 添加了一个控件如label,并且IBOutlet连线,但是:运行的时候该label却没有初始化显示为nil】
【312】【JSBadgeView 是一个可定制的在视图上显示徽章的 iOS 组件】
【311】【iphone6截屏750 X 1334】
【310】【框架请求失败,提示405不支持POST,只allow GET】
位于类:AFHTTPRequestOperation.m
位于方法:
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
具体代码:
id responseObject = self.responseO
if (self.error) {
if (failure) {
dispatch_group_pletionGroup ?: http_request_operation_completion_group(), pletionQueue ?: dispatch_get_main_queue(), ^{
failure(self, self.error);
if (success) {
dispatch_group_pletionGroup ?: http_request_operation_completion_group(), pletionQueue ?: dispatch_get_main_queue(), ^{
success(self, responseObject);
(lldb) po self.response
{ URL: http://192.168.1.124:555/api/System/GetUserIdentityInfo } { status code: 405, headers {
Allow = GET;
Cache-Control = no-
Content-Length = 73;
Content-Type = application/ charset=utf-8;
Date = Mon, 11 May :47 GMT;
Expires = -1;
Pragma = no-
Server = Microsoft-IIS/7.5;
X-AspNet-Version = 4.0.30319;
X-Powered-By = ASP.NET;
(lldb) po self.responseObject
Message = The requested resource does not support http method &#39;POST&#39;.;
【309】【关于xcode自己revoke(吊销)certificate(证书)的问题】
原因:新target运行项目的时候,提示找不到描述文件;xcode提议 自动fix issue
描述:这时候,xcode会 revoke(吊销)原来的certificate(证书),因此,与原来证书相关联的描述文件,全部会失效;
解决方法:正确的做法是:从团队其他人员拷贝描述文件到本机,双击导入;在xcode项目配置的设置中 选择刚才导入的描述文件,进而选择code sign identity
【308】【方形图片变圆】
70 * 70的话,圆角只要设置成half即可,即:35
// 从xib中加载 实例化一个SynClassCell对象
+ (ParentDetailTopView *)ParentDetailTopView
// mainBundel加载xib,扩展名不用写.xib
NSArray *arrayXibObjects = [[NSBundle mainBundle] loadNibNamed:@ParentDetailTopView owner:nil options:nil];
ParentDetailTopView *topView = [arrayXibObjects firstObject];
topView.headImgView.layer.masksToBounds = YES;
topView.headImgView.layer.cornerRadius = 35.f;
return topV
【305】【scrollView滚动范围】【// 重置contentView的滚动范围必须大于其bounds的高,才能滚动】
【304】【cell侧滑ime删除】
1.dataSource的方法:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
此方法就是给一个空的实现滑动也会出现删除按钮!!
2. 必须先删除数据源
[blockSelf.arrayData removeObjectAtIndex:indexPath.row];
// 再删除view
[blockSelf.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[blockSelf.tableView reloadData];
【301】【弹出动画】
注意在viewDidAppear调用
- (void)addKeyAnimation
CAKeyframeAnimation *
animation = [CAKeyframeAnimation animationWithKeyPath:@transform];
animation.duration = 0.5;
animation.delegate =
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeF
NSMutableArray *values = [NSMutableArray array];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 0.9)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
animation.values =
[_contentView.layer addAnimation:animation forKey:nil];
【299】【ineligible devices】
iphone 6 with 8.3系统,连接到xcode 6.01 时,
提示:ineligible devices
原因:xcode版本太低
解决办法:
换成xcode 6.1 即可
==============
Xcode 6.1 update. The 6.0.1 does&#39;t support iOS 8.1.
【查看原文】
【298】【二次包装过程】
将一个字典,包装成一个大的大典,再转成jsonString
// 二次包装过程
NSArray *modelArr = [MarkModel objectArrayWithKeyValuesArray:dataArr];
MarkBigModel *bigModel = [[MarkBigModel alloc]init];
bigModel.FScore = 5;
NSArray *dictArray = [MarkModel keyValuesArrayWithObjectArray:modelArr];
bigModel.MciMcBusiSiteRemarkItems = dictA
bigModel.RemarkCount = modelArr.
// 模型 转 字典,之后就可以用字典 转 jsonString
NSDictionary *bigDict = bigModel.keyV
另1种是 通过NSJSONSerialization 转成Data,再从Data 转成jSON string,会有反斜线
NSData *data = [NSJSONSerialization dataWithJSONObject:bigDict options:NSJSONReadingMutableLeaves error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
【297】【OC的字典转成jsonString】
// 重要说明:content此时已经从json串 转成了OC的字典 1种是 通过JSONKIT,可将字典转成json字符串;
// self.jsonString = [(id)content JSONString]; 另1种是 通过NSJSONSerialization 转成Data,再从Data 转成jSON string
NSData *data = [NSJSONSerialization dataWithJSONObject:content options:NSJSONWritingPrettyPrinted error:nil];
self.jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
【296】【appdelegate中的支付回调1】
// pay ---- 3
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
[Pingpp handleOpenURL:url withCompletion:nil];
[[NSNotificationCenter defaultCenter]postNotificationName:@notificationCenter_userPayOrNot object:nil];
return YES;
(lldb) po url
jzh://pingpp?result=success
(lldb) po sourceApplication
com.apple.mobilesafari
(lldb) po annotation
【293】【代码改约束】
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// // 当事件触发时,改变其constant值,然后调用约束所在的对象的 layoutIfNeeded方法,固定的~ 例如:
// _topView.collectionViewHeightConstraint.constant = 50;
// // self.leftMarginConstraint.constant = 100;
// // self.widthConstraint.constant = 200;
// [UIView animateWithDuration:2.0 animations:^{
// [self.view layoutIfNeeded];
// [_topView layoutIfNeeded];
【292】【cell图片在xib中aspect fit无效,只能用代码调整】
self.img.contentMode = UIViewContentModeScaleAspectF
self.img.clipsToBounds = YES;
【291】【cell分割线设置,其实是tableView的属性separatorStyle】
将UITableView的separatorStyle属性设置为UITableViewCellSeparatorStyleNone即可,如下:
tableView.separatorStyle = UITableViewCellSeparatorStyleN
【289】【隐藏导航条】
// 导航控制器的显示和隐藏【提示,如果使用navigationBarHidden属性,侧滑会出问题】
- (void)viewWillAppear:(BOOL)animated
[super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = YES;
- (void)viewWillDisappear:(BOOL)animated
[super viewWillDisappear:animated];
self.navigationController.navigationBar.hidden = NO;
【286】【Cell点击特效 取消】
cell.selectionStyle = UITableViewCellSelectionStyleN
【285】【动画特效1】
CAKeyframeAnimation *
animation = [CAKeyframeAnimation animationWithKeyPath:@transform];
animation.duration = 0.5;
animation.delegate =
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeF
NSMutableArray *values = [NSMutableArray array];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 0.9)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
animation.values =
[_contentView.layer addAnimation:animation forKey:nil];
【284】【url schemes】
工程---&targets---&info---&urlTypes
identifier: com.sg31.www
url schemes: beyond
下面的为接收到外部调用的时候程序启动,响应方法,在safari输入:beyond://com.sg31.www
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if ([[url scheme] isEqualToString:@beyond]) {
NSLog(@外部调用成功);
return YES;
【283】【iOS开发的一些奇巧淫技】【进入网址】
【282】【auto adjust cell】
viewdidload
tableView.rowHeight = UITableViewAutomaticD
tableView.estimatedRowHeight = 10;
cellForRow
[cell layoutIfNeeded];
【281】【btn得到cell得到table得到row】
while (![btn isMemberOfClass:[self class]]){
btn = (UIButton *)[btn superview];
MyProjectCell *cell = (MyProjectCell *)
UITableView *tableView = (UITableView *)
while (![tableView isMemberOfClass:[UITableView class]]){
tableView = (UITableView *)[tableView superview];
NSIndexPath *path = [tableView indexPathForCell:cell];
row = path.
// 已经弃用,调用外界的控制器的block,并将cell的行号传递过去
// _wannaChangeStatusBlock(row); 调用外界的控制器的block,并将cell的行号传递过去
_wannaChangeStatusBlockExt(row,cell);
【279】【textView占位】
Easy way, just create placeholder text in UITextView by using the following UITextViewDelegate methods:
- (void)textViewDidBeginEditing:(UITextView *)textView
if ([textView.text isEqualToString:@placeholder text here...]) {
textView.text = @;
textView.textColor = [UIColor blackColor]; //optional
[textView becomeFirstResponder];
- (void)textViewDidEndEditing:(UITextView *)textView
if ([textView.text isEqualToString:@]) {
textView.text = @placeholder text here...;
textView.textColor = [UIColor lightGrayColor]; //optional
[textView resignFirstResponder];
just remember to set myUITextView with the exact text on creation e.g.
UITextView *myUITextView = [[UITextView alloc] init];
myUITextView.delegate =
myUITextView.text = @placeholder text here...;
myUITextView.textColor = [UIColor lightGrayColor]; //optional
and make the parent class a UITextViewDelegate before including these methods e.g.
@interface MyClass ()
【进入网址】
【274】【nsrange,是 一个结构体,方法: NSMakeRange(&#NSUInteger loc#&, &#NSUInteger len#&)】
【273】【iOS开发的一些奇巧淫技】【查看原文】
【272】【awakeFromNib】
- (id)initWithFrame:(CGRect)frame
self = [super initWithFrame:frame];
if (self) {
// Initialization code
- (void)awakeFromNib{
[super awakeFromNib];
NSLog(@call %s, __FUNCTION__);
self.backgroundColor = [UIColor redColor];
// 其他初始化方法
【271】【先对数组统一排序,再进行分组,再组内排序】
// 其他情况,返回是数组
NSMutableArray *contentDictArr = (NSMutableArray *)
DLog(@返回是数组,长度是 %d,contentDictArr.count);
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// NSArray 转成 NSMutableArray
// 0、对于不启用的,即enabled为0的字典模型,删除掉
NSMutableArray *dictArr = [NSMutableArray array];
for (NSInteger i = 0; i & contentDictArr. i++) {
NSDictionary *dict = contentDictArr[i];
if ([[dict objectForKey:@FEnabled]intValue] == 1) {
[dictArr addObject:dict];
// DLog(@清除未启用的字典后的数组:%@,dictArr);
// 0.1、对于被包含的模块,暂时剔除
NSMutableArray *tempdictArr = [NSMutableArray array];
for (NSInteger i = 0; i & dictArr. i++) {
NSDictionary *dict = dictArr[i];
// 如果有值,则说明是某个模块的子模块@26e8e1-a7d5-6d513c02de39
// 如果没有值,即NSNull,表示是根目录模块,直接展示
if ([[dict objectForKey:@FUpCMID] class] == [NSNull class]) {
[tempdictArr addObject:dict];
} 1、对数组按GroupTag排序
NSArray *sortDesc = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@FGroupTag ascending:YES]];
NSArray *sortedArr = [tempdictArr sortedArrayUsingDescriptors:sortDesc];
// DLog(@排序后的数组:%@,sortedArr);
2、对数组进行分组,按GroupTag
// 遍历,创建组数组,组数组中的每一个元素是一个模型数组
NSMutableArray *testGroupArr = [NSMutableArray array];
NSMutableArray *currentArr = [NSMutableArray array];
// 因为肯定有一个字典返回,先添加一个
[currentArr addObject:sortedArr[0]];
[testGroupArr addObject:currentArr];
// 如果不止一个,才要动画添加
if(sortedArr.count & 1){
for (NSInteger i = 1; i & sortedArr. i++) {
// 先取出组数组中 上一个模型数组的第一个字典模型的groupID
NSMutableArray *preModelArr = [testGroupArr objectAtIndex:testGroupArr.count-1];
NSInteger preGroupID = [[[preModelArr objectAtIndex:0] objectForKey:@FGroupTag] intValue];
// 取出当前字典,根据groupID比较,如果相同则添加到同一个模型数组;如果不相同,说明不是同一个组的
NSDictionary *currentDict = sortedArr[i];
NSInteger groupID = [[currentDict objectForKey:@FGroupTag] intValue];
if (groupID == preGroupID) {
[currentArr addObject:currentDict];
// 如果不相同,说明 有新的一组,那么创建一个模型数组,并添加到组数组testGroupArr
currentArr = [NSMutableArray array];
[currentArr addObject:currentDict];
[testGroupArr addObject:currentArr];
// 3、遍历 对每一组 进行排序
NSMutableArray *tempGroupArr = [NSMutableArray array];
for (NSArray *arr in testGroupArr) {
// NSArray *sortDesc = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@FOrder ascending:YES]];
NSArray *tempArr = [arr sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
if([[obj1 objectForKey:@FOrder]intValue] & [[obj2 objectForKey:@FOrder]intValue]){
return NSOrderedA
if([[obj1 objectForKey:@FOrder]intValue] & [[obj2 objectForKey:@FOrder]intValue]){
return NSOrderedD
return NSOrderedS
[tempGroupArr addObject:tempArr];
testGroupArr = tempGroupA
DLog(@封装好的group数组:%@,testGroupArr);
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// testGroupArr 将封装好的字典数组缓存起来,以便下次调用 userDefault_localGroupArr
// 根据用户上次选择的,展示
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault setBool:YES forKey:@userDefault_hasCached_moduleDictArr];
NSString *jsonStr = testGroupArr.JSONS
DLog(@没有网络的时候用:jsonStr:%@,jsonStr);
[userDefault setObject:jsonStr forKey:@testGroupArr_jsonStr];
[userDefault sync
【270】【自动布局scrollView】
contentSize 必须明确指定,如label距离下方多少,距离右边多少,这样才可以 让scrollView计算出contentSize
【查看原文】
【267】【inDatabase: was called reentrantly on the same queue, which would lead to a deadlock】
在使用时,如果在queue里面的block执行过程中,又调用了 indatabase方法,则会检查 是不是同一个queue,如果是同一个queue会死锁;原因很简单:
队列里面 放了一个block,该block又在 本队列 后面放了一个 block;
从而:前一个block 里面 调用了 后一个block,必须等后一个block执行完成了,
前一个block才会 出队列;
而后一个block想要执行,则又必须先等 前一个block出队列;
因此 死锁!!!!
解决方法:在indatabase的block中,不要再调用indatabase方法
[[[DBHelper shareInstance] dbQueue]inDatabase:^(FMDatabase *db){
isSuccess = [self.helper update4Table:TB_User_Friend withArgs:args where:where];
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- (void)inDatabase:(void (^)(FMDatabase *db))block {
/* Get the currently executing queue (which should probably be nil, but in theory could be another DB queue
* and then check it against self to make sure we&#39;re not about to deadlock. */
FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey);
assert(currentSyncQueue != self && inDatabase: was called reentrantly on the same queue, which would lead to a deadlock);
【261】【ios_xib_preview预览】
右上方----show the assistant edit ---- 选择新窗口中manual最下方的Preview
【258】【应该竖屏,仅在视频播放页面横屏】
在app delegate中,启动时,
[userDefault setBool:NO forKey:@userDefault_isAllowLandscape];
[userDefault synchronize];
在app delegate中,通过一个本地保存的key进行判断,是否进行横屏
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
// 全局的设置:允许竖屏+横屏
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
BOOL isAllowLandscape = [userDefault boolForKey:@userDefault_isAllowLandscape];
if (isAllowLandscape) {
return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskL
return UIInterfaceOrientationMaskP
在视频播放控制器中,更改本地保存的key即可
【257】【模拟器上面 播放视频崩溃】
iphone 4s 8.0系统的模拟器上面 播放视频:
Apr 9 11:44:39 [jun] rtcreporting[57158] : logging starts...
Apr 9 11:44:39 [jun] rtcreporting[57158] : setMessageLoggingBlock: called
在模拟器上面播放视频
解决办法:
去掉全局断点,这是一个bug
【256】【iphone真机死活不旋转】
死活不走代理方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
return (interfaceOrientation == UIInterfaceOrientationPortrait
|| interfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
原因可能是:手机上拉快速设置栏中:竖排方向锁定 :打开了
【255】【导航返回按钮】
UIButton* btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width+10, 40)];
btn.showsTouchWhenHighlighted = YES;
[btn setImage:image forState:UIControlStateNormal];
[btn addTarget:theTarget action:sel forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBtn = [[UIBarButtonItem alloc] initWithCustomView:btn];
backBtn.tag = 9528;
vc.navigationItem.leftBarButtonItem = backB
【254】【ios_VLC】
VLC for iOS 2.3.0
关于VLC配置问题,根据个人经验整理了一下,希望能帮到需要的朋友。
官网链接:https://wiki.videolan.org/IOSCompile/
百度云盘链接:/s/1bnEOXPH 密码:ur4l
配置说明(百度云盘)
官网按照说明操作就可以了只是下载的地址是个谷歌的什么网站,所以你懂得。
百度云盘下载下来后需要配置下文件VLC/ios/External 这个文件夹下面有六个文件(快捷方式):MediaLibraryKit,MobileVLCKit,PLCrashReporter,QuincyKit,gtl,upnpx
重新配置下这六个文件路径就可以用了,vlc是区分真机和模拟器的
终端配置路径
1、在终端进入External文件夹
2、ln -s -f是终端修改文件路径的,关于终端命令不懂的朋友请百度,在此就不班门弄斧了。
真机就用Release-iphoneos,模拟器就用Release-iphonesimulator
ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/MediaLibraryKit/build/Release-iphoneos MediaLibraryKit
ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/VLCKit/build/Release-iphoneos MobileVLCKit
ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/PLCrashReporter/build/Release-iphoneos PLCrashReporter
ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/QuincyKit/client/iOS/QuincyLib/build/Release-iphoneos QuincyKit
ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/GDrive/build/Release-iphoneos gtl
ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/upnpx/projects/xcode4/upnpx/build/Release-iphoneos upnpx
3、路径正确的话就没问题了,ls -l 查看文件路径
修改完成后就可以启动了VLC/iOS/VLC for iOS.xcodeproj
注意:我有时候配置正确路径但是文件还是报错,这种情况的话解压重新搞吧,暂时不知道怎么处理。
SimplePlayback
这个是VLC在线播放的一个demo,路径:VLC/ios/ImportedSources/VLCKit/Examples_iOS/SimplePlayback
项目直接拷贝出来不能用的,要配置下。
libMobileVLCKit.a 这个demo用到这个静态库。静态库区分真机和模拟器的。静态库我不太懂怎么配置,搞了几次没搞定
不过有另外的办法MobileVLCKit.framework这个不区分真机和模拟器的。
路径:VLC/ios/ImportedSources/VLCKit/build
注意:Deployment target 要低于7.0
最后希望能帮到需要的朋友,不懂得可以联系我,qq:,加好友请说明谢谢,由于工作原因可能无法及时回复请见谅,而且我也是刚接触vlc。
关键词:iOS VLC
MediaLibraryKit项目中的Search paths使用相对路径就可以了。
Header Search Paths --& ../../External/MobileVLCKit/include
Library Search Paths --& ../../External/MobileVLCKit
MediaLibraryKit项目中相对路径$(SRCROOT)得到的值是/XXX/XXX/VLC/ios/ImportedSources/MediaLibraryKit,而不是想象中的/XXX/XXX/VLC/ios/
多谢LZ的奉献~~~
【查看原文】
【253】【ios_VLC】【查看原文】
【247】【dispatch_after延时改变约束】
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 当事件触发时,改变其constant值,然后调用约束所在的对象的 layoutIfNeeded方法,固定的~ 例如:
_topView.collectionViewHeightConstraint.constant = 50;
// self.leftMarginConstraint.constant = 100;
// self.widthConstraint.constant = 200;
[UIView animateWithDuration:2.0 animations:^{
[self.view layoutIfNeeded];
[_topView layoutIfNeeded];
【246】【this class is not key value coding-compliant for the key HeightConstraint】
this class is not key value coding-compliant for the key HeightConstraint
在IB上拖线时的时候,有多的 ,删除掉即可
【227】【ios_数组中放枚举】
NSInteger _btnTagArr[4] = {ContactSelectBtnChatting,ContactSelectBtnTel,isTeacher?ContactSelectBtnLeave:ContactSelectBtnDetail};
【226】【实时获得webView的contentSize】
iOS 如何计算UIWebView的ContentSize
首选要等UIWebView加载内容后,然后在它的回调方法里将webview的高度Height设置足够小,就设置为1吧,因为这样才能用
sizeThatFits才能计算出webview得内容大小
- (void)webViewDidFinishLoad:(UIWebView *)aWebView {
CGRect frame = aWebView.
frame.size.height = 1;
aWebView.frame =
CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero];
frame.size = fittingS
aWebView.frame =
NSLog(@size: %f, %f, fittingSize.width, fittingSize.height);
UIWebView计算高度 ( 14:48:39)转载
标签: uiwebview 高度 计算 sizethatfits 分类: ios
- (void)webViewDidFinishLoad:(UIWebView *)webView{
float height = [[webView stringByEvaluatingScriptFromString:@document.body.offsetH] floatValue];
//document.body.scrollHeight
- (void) webViewDidFinishLoad:(UIWebView *)webView
CGRect frame = webView.
CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
frame.size = fittingS
webView.frame =
- (void)viewDidLoad {
[super viewDidLoad];
webview.delegate =
[webview loadHTMLString:@
baseURL:nil];
- (void)webViewDidFinishLoad:(UIWebView *)webView
NSString *output = [webview stringByEvaluatingFromString:@document.getElementByIdx_x_x_x(foo).offsetH];
NSLog(@height: %@, output);
【224】【popping动画演示】【进入网址】
【223】【第3方集成支付】【进入网址】
【222】【7新特性之XCODE】【进入网址】
【218】【变量名和类型相同时的异常错误】
FilterCtrl *FilterCtrl = [[FilterCtrl alloc]init];
这样命名变量,会报错,提示:没有声明alloc方法。。。。
【217】【定义枚举】
// 定义一个枚举
typedef enum {
// 返回按钮
FootViewBtnTypeBack,
FootViewBtnTypeMine,
FootViewBtnTypeWriteComment,
// 查看评论
FootViewBtnTypeReadComment,
// 关注、取消关注
FootViewBtnTypeAttention,
// 更多按钮
FootViewBtnTypeMore
} FootViewBtnT
【216】【scrollView滚动方向】
向上拉时,contentOffset.y为正
向下拉时,contentOffset.y为负
滚动判断用到的变量:
typedef void (^ScrollBlock)(void);
// 向上滚动时的block
@property (nonatomic,strong) ScrollBlock scrollUpB
// 向下滚动时的block
@property (nonatomic,strong) ScrollBlock scrollDownB
// 滚动判断
CGFloat startY;
BOOL isNowUp;
BOOL isUserD
#pragma mark - 滚动,新增,显示,隐藏
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
// 开始时,标记置真
isUserDrag = YES;
// 记录一下开始滚动的offsetY
startY = scrollView.contentOffset.y;
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
// 结束时,置flag还原
isUserDrag = NO;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
// 只有用户drag时,才进行响应
if(isUserDrag){
// 判断一下,并发出通知
CGFloat newY = scrollView.contentOffset.y;
if(startY - newY &0){
// 说明向上滚动
if(!isNowUp){
//通过block告诉外部控制器
if(_scrollUpBlock){
_scrollUpBlock();
isNowUp = YES;
isDown = NO;
}else if(startY - newY&0){
// 说明向下滚动
if(!isDown){
//通过block告诉外部控制器
if(_scrollDownBlock){
_scrollDownBlock();
isDown = YES;
isNowUp = NO;
startY = scrollView.contentOffset.y;
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
if (_scrollDownBlock && self.tableView.contentSize.height - (self.tableView.contentOffset.y+self.tableView.bounds.size.height) & 1) {
_scrollDownBlock();
if(_scrollUpBlock){
_scrollUpBlock();
isNowUp = YES;
isDown = NO;
【214】【MJRefresh的github】【点击下载】
【211】【如何设置appIcon】【点击targets---&general---&use asset catalog】【查看原文】
【210】【DLog】
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@%s [Line %d] fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define DLog(...)
【209】【特效滤镜】【点击下载】
【208】【往模拟器里添加照片的最简单的方法:直接把照片拖到模拟器上就可以了】
【202】【OCR图像识别】【可以实现类似taobao客户端扫描银行卡号的功能】【查看原文】
【201】【Not a git repository】
fatal: Not a git repository (or any of the parent directories): .git
解决办法:git init 即可
【199】【第3方_VKPlayer播放器】【进入网址】
【198】【pod install报错 版本不兼容】【VKVideoPlayerTests` (iOS 5.0) is not compatible with `Expecta (0.3.2)` which,解决方法:将项目deployment改高一点如:6.1即可】
【197】【CardI扫描卡没有反应】【 card.io only scans 5 card types (MasterCard, Visa, Discover, American Express, JCB),后面是stackoverflow的解答】【进入网址】 【查看原文】
【196】【无法在真机运行,XCode提示ineligible device】【解决办法:在targets----&build settings----&iOS Deployment Target选择iOS6.1或者更低的版本】
【195】【正则NSPredicate检查中文】
// 检查汉字,YES代表全是汉字
- (BOOL)isHanziCheck:(NSString *)str
// NSString *regex = @[a-zA-Z一-][a-zA-Z0-9一-]+;
NSString *regex = @[一-]{2,8};
NSPredicate *pred = [NSPredicate predicateWithFormat:@SELF MATCHES %@, regex];
if(![pred evaluateWithObject: str]){
//此动画为在顶上显示文字
[MPNotificationView notifyWithText:@昵称只能由中文、字母或数字组成
andDuration:0.5];
return NO;
return YES;
【186】【判断包含字符串NSRange】
NSRange range = [requestURLStr rangeOfString:@];
if (range.length & 0) {
if(range.location !=NSNotFound){
【184】【SDWebImage默认会永久缓存一张图片】【但如果同一个url下的图片是变化的,那暂时想到的是用内存缓存,[imgView sd_setImageWithURL:url placeholderImage:imgPlace options:SDWebImageCacheMemoryOnly];】
【180】【URL Schemes打开app】【进入网址】
【179】【URL Schemes打开app】【进入网址】
【165】【UILabel显示:标题。。。张数,设置NSLineBreakByTruncatingMiddle即可】
【162】【UserDefault写入的目录是:/var/mobile/Applications/Library/Preferences/com.beyond.testUserD.plist】
【161】【自动定位:中国浙江省杭州市西湖区西溪街道文二路下宁巷3-1号, 中国浙江省杭州市西湖区西溪街道文二路下宁巷3-1号 @ &+30.0.& +/- 100.00m, region (identifier &+30.0.& radius 49.29) &+30.0.& radius 49.29m】
【160】【自动定位:No. 3-1 Xianing Alley, No. 3-1 Xianing Alley, Wen&#39;er Road Xixi Residential District, Xihu Hangzhou, Zhejiang China @ &+30.0.& +/- 100.00m, region (identifier &+30.0.& radius 49.29) &+30.0.& radius 49.29m】
【80】【打开模拟器】【XCode--&Open Developer Tool--&Simulator】
【79】【Unable to determine simulator device to boot】【原因:XCode不知道选择哪一个模拟器去运行app. 解决方法:退出所有XCode和模拟器,若还不行,就重启mac】
【78】【错误installAppearanceSwizzlesForSetter】【原因是:[[UINavigationBar appearance] setTranslucent:NO]在iOS8中才有, 解决办法:#define IOS8 [[[UIDevice currentDevice] systemVersion] floatValue] &= 8.0 if(IOS8 && [UINavigationBar conformsToProtocol:@protocol(UIAppearanceContainer)]) { [[UINavigationBar appearance] setTranslucent:NO]; }】
【71】【判断tableView滚动到了最后一行】【self.tableView.contentSize.height =contentOffset+bounds.size.height】
【61】【Cell中,先执行这个- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier,再执行这个-(void)awakeFromN】
【60】【AutoLayout中,如何让ImageView保持固定的宽高比?例如1:1】【先将imageViewframe手动写成:宽20,高20,再勾选Aspect Ratio添加宽高比约束】【查看原文】
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'}

我要回帖

更多关于 xcode模拟器安装app 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信