经常用到的 编程语句

push到下一页时隐藏tabBar

self.hidesBottomBarWhenPushed=YES;


  self.tabBarController.tabBar.hidden = hide;


//self.navigationController.navigationBarHidden=YES;

改变placehoder的字体颜色

 UIColor*color=[UIColor blackColor];

               textField.attributedPlaceholder=[[NSAttributedString alloc]initWithString:@"请输入" attributes:@{NSForegroundColorAttributeName:color}];

    

设置button在左边


        longlongButton.titleLabel.textAlignment = NSTextAlignmentLeft;

        longlongButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

        longlongButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);

    

 设置导航栏的颜色    

self.navigationController.navigationBar.barTintColor = [UIColor blackColor];


有多个button  只有一个处于选中状态



-(void)buttonclick:(UIButton*)button

{

    if (button!=_button)

    {

        _button.selected=NO;

        _button=button;     

    }

    _button.selected=YES;

    

}


post请求


 NSString*urlString=[[NSString alloc]initWithFormat:@"%@?command=ST_H&access_token=%@",HOST,kGetaccess_token];



 NSString*urlString=[[NSString alloc]initWithFormat:@"%@?command=ST_F_FL&access_token=%@",HOST,kGetaccess_token];



label左右都对齐


    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 21)];


    label.backgroundColor = [UIColor orangeColor];


    [self.view addSubview:label];


     

    NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:@"TViewController"];


    //计算文字大小,参数一定要符合相应的字体和大小


    CGSize attributeSize = [attributeString.string sizeWithAttributes:@{NSFontAttributeName:label.font}];


    //计算字符间隔


    CGSize frame = label.frame.size;


    NSNumber *wordSpace = [NSNumber numberWithInt:(frame.width-attributeSize.width)/(attributeString.length-1)];


    //添加属性


    [attributeString addAttribute:NSKernAttributeName value:wordSpace range:NSMakeRange(0, attributeString.length)];


    

    label.attributedText = attributeString;



label自动换行

rightLab.lineBreakMode = NSLineBreakByWordWrapping;

rightLab.numberOfLines = 0;


cell右边的>属性

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;


去掉tableView中多余的行

  _tableView.tableFooterView=[[UIView alloc]initWithFrame:CGRectZero];


静态变量设置

 static NSString * cellIndentfier = @"cellIndentfier";


变导航条颜色:


self.navigationController.navigationBar.barTintColor=BGVIEW_COLOR1;

改变label的字体


label字体居中

peopelLab.textAlignment=NSTextAlignmentCenter;


输入框字体大小

text.font = [UIFont fontWithName:@"Arial" size:20.0f];

text.clearButtonMode = UITextFieldViewModeAlways;

//是否纠错

  text.autocorrectionType = UITextAutocorrectionTypeNo;

//再次编辑就清空

  text.clearsOnBeginEditing = YES; 

//内容的垂直对齐方式  UITextField继承自UIControl,此类中有一个属性contentVerticalAlignment

  text.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;

 /设置为YES时文本会自动缩小以适应文本窗口大小.默认是保持原来大小,而让长文本滚动 

  textFied.adjustsFontSizeToFitWidth = YES;

 

//设置自动缩小显示的最小字体大小

  text.minimumFontSize = 20;

//首字母是否大写

  text.autocapitalizationType = UITextAutocapitalizationTypeNone;


 //管理左上角的网络活动指示器

    [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];

设置btn上面字体大小

_imageSwith.titleLabel.font = [UIFont systemFontOfSize: 14.0];


设置点击cell动画

[tableView deselectRowAtIndexPath:indexPath animated:YES];

//网址uitableView

http://www.baidu.com/link?url=Gxu3pWNuNqMfoApSeCnPe9tWZl3zbriV6W5gd6r2aULIgXjLV7KOT1utfX2VVrbQlNRYWrNBo6b8rtg6CsnPEnvL6M20Gby2J1d__aTBooq


//webView隐藏滑栏,和自适应

_webView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        _webView.autoresizingMask = UIViewAutoresizingFlexibleHeight;


        [(UIScrollView*)[_webView.subviews objectAtIndex:0] setShowsHorizontalScrollIndicator:NO];

        [(UIScrollView*)[_webView.subviews objectAtIndex:0] setShowsVerticalScrollIndicator:NO];

 [_webView loadHTMLString:article._content baseURL:nil];



cell点击消失背景颜色

[tableView deselectRowAtIndexPath:indexPath animated:YES];


//把数组拼接成字符串并加,衔接浮

 NSString *string = nil;

    NSString *lastString = @"";

    for (NSString *value in _selectArray) {

        string = [NSString stringWithFormat:@"%@,%@", lastString, value];

        NSLog(@"value:%@", value);

        NSLog(@"string:%@",string);

        lastString = [NSString stringWithFormat:@"%@", string];

    } 

    NSLog(@"拼接输出:%@", string);


//替换字符

str =[str stringByReplacingOccurrencesOfString:@"world" withString:@"India"];

NSString* textStr=[textString substringFromIndex:2];//从第二个字符开始截取

[textString rangeOfString:@"img"].location !=NSNotFound                  /  /                            //包含

  

我们会用到这个函数

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath

{


//我让第一个cell 点击的时候没有反应

    if (indexPath.row ==0) {

        returnnil;

    }

    return indexPath;

}


//改变webView字体大小

1 - (void)webViewDidFinishLoad:(UIWebView *)webView方法中加入js代码  

2     NSString *str = @"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '60%'";  

3     [_webView stringByEvaluatingJavaScriptFromString:str];


1 NSString *jsString = [[NSString alloc] initWithFormat:@"document.body.style.fontSize=%f;document.body.style.color=%@",fontSize,fontColor];   

2         [webView stringByEvaluatingJavaScriptFromString:jsString];  


//改变webView上图片大小

[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var script = document.createElement('script');"

     "script.type = 'text/javascript';"

     "script.text = \"function ResizeImages() { "

     "var myimg,oldwidth;"

     "var maxwidth=%f;" //缩放系数

     "for(i=0;i <document.images.length;i++){"

     "myimg = document.images[i];"

     "if(myimg.width > maxwidth){"

     "oldwidth = myimg.width;"

     "myimg.width = maxwidth;"

     "myimg.height = myimg.height * (maxwidth/oldwidth);"

     "}"

     "}"

     "}\";"

     "document.getElementsByTagName('head')[0].appendChild(script);",webView.frame.size.width-20]];

     

    

    [webView stringByEvaluatingJavaScriptFromString:@"ResizeImages();"];




 __weak ASIFormDataRequest * dataRequest = request;  加上 这句   在下面

数据这里 dataRequest



购物商城项目采用PHP+mysql有以及html+css jq以及layer.js datatables bootstorap等插件等开发,采用了MVC模式,建立一个完善的电商系统,通过不同用户的不同需求,进行相应的调配和处理,提高对购买用户进行配置….zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值