May~~~

05-5

1  "_OBJC_CLASS_$_Play", referenced from:

解决方案:

Tagert--Build Phases -- Compile Sources 下添加对应的.m文件

2. iOS     addChildViewController
http://www.cnblogs.com/zengyou/p/3386605.html

iOS开发剖析网易新闻标签栏视图切换(addChildViewController属性介绍)

http://www.it165.net/pro/html/201406/16429.html

IOS开发之自定义Button(集成三种回调模式)

http://www.it165.net/pro/html/201409/21930.html

3.设置字符串不同颜色,大小封装方法

#pragma mark 可变字符串

- (NSAttributedString *)setCmtHeaderViewLabel:(NSString *)text


{

    /**转为可变属性的字符串 */

    NSMutableAttributedString *attrText = [[NSMutableAttributedStringalloc]initWithString:text] ;

    NSLog(@"字符串长度为%ld" , text.length) ;

    //颜色

    UIColor *type1Color =kUIColorFromRGBWithAlapha(252,172,17,1);

   

    [attrText addAttribute:NSForegroundColorAttributeNamevalue:type1Colorrange:NSMakeRange(4, text.length -4)];

    [attrText addAttribute:NSFontAttributeNamevalue:[UIFontsystemFontOfSize:20]range:NSMakeRange(4, text.length -4)];

       return attrText;

}

4.定义颜色宏

/// RGB 颜色和透明度

#define kUIColorFromRGBWithAlapha(RedValue ,GreenValue,BlueValue, AlphaValue )      [UIColor colorWithRed:RedValue/255.0 green:GreenValue/255.0 blue:BlueValue/255.0 alpha:AlphaValue]

5.学习

http://www.it165.net/Pro/ydip/

6.视图缩放动画

http://bbs.csdn.net/topics/390655895?page=1

http://www.cnblogs.com/pengyingh/articles/2378732.html


05-06
 1. 

编绎显示Unknown type name “CGFloat”等 错误解决方法

分类: iOS编程   51人阅读  评论(0)  收藏  举报

一、编绎显示Unknown type name “CGFloat” 等 错误解决方法

将Compile Sources As 改为 Objective-C++

  


二、如果是extern const引起的。直接加头文件

#import <UIKit/UIKit.h>


2.  

[@(value) description] 的妙用NSStringFromValue

分类: Objective-C   66人阅读  评论(1)  收藏  举报

开发中,经常会用到将int格式化成NSString,还在使用format(@"%d",int);那就过时了。

【新用法】看下面宏定义:

#define NSStringFromValue(value)                                [@(value) description]

可以这么使用:
NSStringFromValueint 类型)
NSStringFromValuefloat 类型) //long 型等,基础数据类型
NSStringFromValuechar* 类型)//C字符串奥,"hellowrold"

类似的宏定义还有:

#define NSStringFromBOOL(value)                                 (value ? @"YES" : @"NO")

#define NSStringFromVariableName(variableName)                  @(#variableName)


3.iOS 第三方登录之 QQ登录

http://blog.csdn.net/liyun123gx/article/details/45531737

4.手势~~~上下左右滑动

UISwipeGestureRecognizer *recognizer; 

     recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFrom:)];

     [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];

     [[self viewaddGestureRecognizer:recognizer];

5.debugging 模式打开Xcode
http://www.cocoachina.com/ios/20150225/11190.html
断点类型   添加条件,  Symbolic Breakpoint , 监控断点,日志信息断点,发声断点
6.textfield
returnKeyType       键盘右下角 return 按钮类型(枚举值)   textField.returnKeyType = UIReturnKeyNext;
inputView               自定义输入视图(默认是键盘)              textField.inputView = myInputView;
inputAccessoryView         输入视图上方的辅助视图(默认 nil )   textField.inputAccessoryView = myAccessoryView;
05-09
加班ing
自定义cell删除效果

1 把delete改成中文删除,自定义上传按钮图片http://blog.csdn.net/xiaoxuan415315/article/details/7834940


05-12

iOS中将汉字转换成拼音

 NSMutableString *pinyin = [_name mutableCopy];
    //转换成拼音
    CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformMandarinLatin, NO);
    //去掉音调
    CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformStripDiacritics, NO);
    NSLog(@"pinyin= %@",pinyin);
// 截取首字母
    NSString * first = [pinyin substringToIndex:1];
    NSLog(@"%@", first);

05-13
根据 时间戳 获取是周几
//    // ***** 时间戳改变显示
//    NSString * dateString =[dict objectForKey:@"createTime"];
//    NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
//    [inputFormatter setDateFormat:@"yyyy-MM-dd HH-mm-ss"];
//    NSDate* inputDate = [inputFormatter dateFromString:dateString];
//    
//    NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
//    dateFormatter1.dateFormat = @"( MM.dd ) HH:mm";
//    NSString *dayTimeStr1 =[dateFormatter1 stringFromDate:inputDate];
//    
//    
//    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
//    dateFormatter.dateFormat = @"EE";
//    [dateFormatter setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]];//年月日转中文
//    
//    
//    NSString *dayTimeStr =[dateFormatter stringFromDate:inputDate];
//    
//    //    NSLog(@"%@======%@",dayTimeStr,dayTimeStr1);
//    
//    cell.timeLable.text =[NSString stringWithFormat:@"%@ %@",dayTimeStr,dayTimeStr1];

05-19
把数字变成大写。。。。
// 搜索文字
    NSString * str = [NSString stringWithFormat:@"¥%.2f万",price];
    NSString *tempStr = @"\\d{1,}";
    
    NSMutableArray *results = [NSMutableArray array];
    NSRange searchRange = NSMakeRange(0, [str length]);
    NSRange range;
    NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:str];
    while ((range = [str rangeOfString:tempStr options:NSRegularExpressionSearch range:searchRange]).location != NSNotFound)
    {
        [results addObject:[NSValue valueWithRange:range]];
        searchRange = NSMakeRange(NSMaxRange(range), [str length] - NSMaxRange(range));
        [string addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:range];
    }
    cell.priceLable.attributedText = string;

05-22
颜色值-十六进制转换
#define ColorHex(string) [CSIIConfigUtil colorWithHexString:string]
+ (UIColor *)colorWithHexString:(NSString *)stringToConvert {
    if ([stringToConvert hasPrefix:@"#"]) {
        stringToConvert = [stringToConvert substringFromIndex:1];
    } else if ([stringToConvert hasPrefix:@"0x"]) {
        stringToConvert = [stringToConvert substringFromIndex:2];
    }
    NSScanner *scanner = [NSScanner scannerWithString:stringToConvert];
    unsigned hexNum;
    if (![scanner scanHexInt:&hexNum]) return nil;
    return [[self class] colorWithRGBHex:hexNum];
}

+ (UIColor *)colorWithRGBHex:(UInt32)hex {
    int r = (hex >> 16) & 0xFF;
    int g = (hex >> 8) & 0xFF;
    int b = (hex) & 0xFF;
    
    return [UIColor colorWithRed:r / 255.0f
                           green:g / 255.0f
                            blue:b / 255.0f
                           alpha:1.0f];
}
附送一个颜色转换网址  http://www.zzsky.cn/tool/rgb_16bit/

05-23
网络请求 链接里面注意不要加空格。。。

05-25
ios7 label自适应方法

UILabel * testlable = [[UILabel alloc]initWithFrame:CGRectMake(10,20,200,20)];
    
    NSString * tstring =@"UILabel  ios7 与ios7之前实现自适应撑高的方法,文本的内容长度不一,我们需要根据内容的多少来自动换行处理。在IOS7下要求font,与breakmode与之前设置的完全一致sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping";
    
    testlable.numberOfLines =2;
    
    UIFont * tfont = [UIFont systemFontOfSize:14];
    
    testlable.font = tfont;
    
    testlable.lineBreakMode =NSLineBreakByTruncatingTail ;
    
    testlable.text = tstring ;
    [testlable setBackgroundColor:[UIColor redColor]];
    
    [self.view addSubview:testlable];
    
    //高度估计文本大概要显示几行,宽度根据需求自己定义。 MAXFLOAT 可以算出具体要多高
    
    CGSize size =CGSizeMake(300,60);
    
    // label可设置的最大高度和宽度
    //    CGSize size = CGSizeMake(300.f, MAXFLOAT);

    //    获取当前文本的属性
    
    NSDictionary * tdic = [NSDictionary dictionaryWithObjectsAndKeys:tfont,NSFontAttributeName,nil];
    
    //ios7方法,获取文本需要的size,限制宽度
    
    CGSize  actualsize =[tstring boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin  attributes:tdic context:nil].size;
    
    // ios7之前使用方法获取文本需要的size,7.0已弃用下面的方法。此方法要求font,与breakmode与之前设置的完全一致
    //    CGSize actualsize = [tstring sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping];
    //   更新UILabel的frame
    
    
    testlable.frame =CGRectMake(10,20, actualsize.width, actualsize.height);
05-26
iOS 模拟出一个半透明的ViewController presentViewController 实现

最近项目有需求, 需要模态初一个半透明的视图, 好多人都碰到这个问题吧, 在目标视图中设置背景颜色然后发现模态动作结束后变成了黑色或者不是半透明的颜色。

所以今天来告诉大家解决方案

- (IBAction)Avtion1:(id)sender {

    TestViewController * testVC = [TestViewController new];

    self.definesPresentationContext = YES; //self is presenting view controller
    testVC.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.4];
    testVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;

    [self presentViewController:testVC animated:YES completion:nil];
}
  • 注意:如果present 一个NavController,不能完全使用上面代码。

- (IBAction)pushSecond:(id)sender{

    SecondViewController * testVC = [SecondViewController new];

    

    self.definesPresentationContext = YES; //self is presenting view controller

    testVC.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.5];

//    testVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:testVC];

    nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;

    nav.view.backgroundColor = [UIColor clearColor];

    [self presentViewController:nav animated:YES completion:nil];

}

 

Json 转换成 NSDictionary(未测)

NSstring*json=@"\"s\":{\"n\":\"刹车\"}";

NSData* alarmInfoData = [json dataUsingEncoding:NSUTF8StringEncoding];

NSDictionary * alarmInfoDic =[NSJSONSerialization JSONObjectWithData:alarmInfoDataoptions:NSJSONReadingMutableLeaves error:nil];


http://blog.csdn.net/u010124617/article/details/45970141

05- 27

1. 遇到了button 点击出现了蓝色的小框框的问题
原来button的 tintColor  是蓝色,修改一个就好了

2.加入刷新遇到的问题,刷新方法没有执行
代码执行顺序问题,因为加刷新的时候,tableview还没有加到view上。


UITableViewCell 在IOS7的父视图是UITableViewWrapperView。

  (2013-11-28 16:11:12)
标签: 

ios7

 

兼容

 

it

分类: iOS
iOS 获取操作系统的版本
[[[UIDevice currentDevice] systemVersion] floatValue]

UITableView *tableView;

     float Version=[[[UIDevice currentDevice] systemVersion] floatValue];

    if(Version>=7.0)

    {

       tableView = (UITableView *)self.superview.superview;

    }

    else

    {

        tableView=(UITableView *)self.superview;

    }

     NSIndexPath *indexPath= [tableView indexPathForCell:self];

    indexPath = [NSIndexPath indexPathForRow:kImage1IndexinSection:indexPath.row];


在IOS7以下系统,UITableViewCell.superview就是UITableView,但在IOS7中,cell上面还多了一个UITableViewWrapperView,所以需要UITableViewCell.superview.superview获取UITableView

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值