For Loop Layout button button radio can be canceled

Source: Internet
Author: User




#import "MineTuChaoViewController.h"

#import "ChoosePhotosview.h"


@interface Minetuchaoviewcontroller () <UIScrollViewDelegate>

{

CGFloat _btnwidth,_btnheight;

Nsinteger _choosebtnnum; -1 is not selected for initialization, the other is the current button event

}

@property (Nonatomic,strong) UIButton *rightbtn;

@property (Nonatomic,strong) Choosephotosview *photoview;


@property (Nonatomic,strong) Uiscrollview *scrollview;

@property (Nonatomic,strong) UIView *contentview;

@property (Nonatomic,strong) UIView *LEIXINGBKGV, *MIAOSHUBKGV, *ZHAOPIANBKGV;


@property (Nonatomic,strong) Nsmutablearray *arrbtn;

@property (Nonatomic,strong) Nsmutablearray *arrleixing;


@end


@implementation Minetuchaoviewcontroller


-(void) Viewdidload {

[Super Viewdidload];

Do any additional setup after loading the view.

Self.title = @ "I want to vomit the groove";

Self.view.backgroundColor = [Uicolor Whitecolor];

Self.navigationItem.leftBarButtonItem = [Backbuttonitem getbackitemwithtitle:@ "" Image:[uiimage imagenamed:@ "Fl_ Fanhui-jian "] target:self action: @selector (gobackpage:)];

Right-hand Confirmation button

SELF.RIGHTBTN = [UIButton buttonwithtype:uibuttontypecustom];

self.rightBtn.userInteractionEnabled = YES;

[Self.rightbtn settitle:@ "submit" forstate:uicontrolstatenormal];

Self.rightBtn.titleLabel.font = Middle_lit_font;

[Self.rightbtn Settitlecolor:theme_green_color Forstate:uicontrolstatenormal];

[Self.rightbtn addtarget:self Action: @selector (CLICKEDRIGHTBTN:) forcontrolevents:uicontroleventtouchupinside];

Self.rightBtn.frame = CGRectMake (0, 0, 40, 30);

Self.navigationItem.rightBarButtonItem = [[Uibarbuttonitem alloc]initwithcustomview:self.rightbtn];

[Self getData];

[Self drawscrollview];

}

-(void) getdata{

_choosebtnnum =-1;

self.arrleixing = [@[@ "Product quality", @ "after-sales service", @ "logistics", @ "app optimization", @ "Business operation", @ "other"] mutablecopy];

}


-(void) Viewwillappear: (BOOL) animated{

[Super viewwillappear:animated];

Self.navigationController.navigationBar.translucent = NO;


}

-(void) Viewwilldisappear: (BOOL) animated{

[Super viewwilldisappear:animated];

}


-(void) drawscrollview{

[Self.scrollview Removefromsuperview];

Self.scrollview = [[Uiscrollview alloc]initwithframe:cgrectmake (0, 0, Screen_width, screen_height)];

self.scrollView.userInteractionEnabled = YES;

Self.scrollView.delegate = self;

Self.scrollView.bounces = YES;

Self.scrollView.backgroundColor = bkg_hex_gray_eee;

[Self.view AddSubview:self.scrollView];

[Self.scrollview mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.edges.mas_equalTo (Self.view);

}];

[Self.scrollview layoutifneeded];

Self.contentview = [[UIView alloc]init];

[Self.scrollview AddSubview:self.contentView];

self.contentView.userInteractionEnabled = YES;

Self.contentView.backgroundColor = bkg_hex_gray_eee;

[Self.contentview mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.edges.mas_equalTo (Self.scrollview);

Make.width.mas_equalTo (Screen_width);

Make.height.mas_equalTo (100);

}];

[Self.contentview layoutifneeded];

_btnwidth = (screen_width-4*text_edge_distance)/3;

_btnheight = 32;

Problem type

[Self drawwentiview];

Problem description

[Self drawmiaoshuview];

Photo

[Self Drawzhaopian];

}


-(void) showchooosephotov{

[Self.photoview Removefromsuperview];

Self.photoview = [[Choosephotosview alloc]init];

Self.photoView.backgroundColor = [Uicolor colorwithwhite:0.7 alpha:0.7];

[Self.view AddSubview:self.photoView];

__weak typeof (self) weakself = self;

[UIView animatewithduration:0.2 animations:^{

[Weakself.photoview mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.edges.mas_equalTo (Self.view);

}];

} completion:^ (BOOL finished) {

}];

}

Type

-(void) drawwentiview{

SELF.LEIXINGBKGV = [[UIView alloc]init];

Self.leiXingBkgV.backgroundColor = [Uicolor Whitecolor];

[Self.contentview AddSubview:self.leiXingBkgV];

[SELF.LEIXINGBKGV mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.centerX.mas_equalTo (Self.contentView.mas_centerX);

Make.left.mas_equalTo (Self.contentView.mas_left);

Make.top.mas_equalTo (Self.contentView.mas_top);

Make.height.mas_equalTo (80);

}];

UIView *SHANGV = [[UIView alloc]init];

[SELF.LEIXINGBKGV ADDSUBVIEW:SHANGV];

Shangv.backgroundcolor = [Uicolor Whitecolor];

[SHANGV mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.top.left.right.mas_equalTo (SELF.LEIXINGBKGV);

Make.height.mas_equalTo (34);

}];

UIView *line_b = [[UIView alloc]init];

[SHANGV Addsubview:line_b];

line_b.userinteractionenabled = YES;

Line_b.backgroundcolor = Bkg_hex_gray_e5;

[Line_b mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.top.left.right.mas_equalTo (SHANGV);

Make.height.mas_equalTo (0.5);

}];

UILabel *namel = [[UILabel alloc]init];

[SHANGV Addsubview:namel];

Namel.text = @ "problem type";

Namel.font = Middle_lit_font;

Namel.textcolor = Text_hex_mid_gray;

[Namel mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.centerY.mas_equalTo (Shangv.mas_centery);

Make.left.mas_equalTo (Shangv.mas_left). Mas_offset (text_edge_distance);

Make.width.mas_greaterThanOrEqualTo (30);

}];

[Namel setcontenthuggingpriority:uilayoutpriorityrequired foraxis:uilayoutconstraintaxishorizontal];

UILabel *nxingl = [[UILabel alloc]init];

[SHANGV Addsubview:nxingl];

Nxingl.text = @ "*";

Nxingl.font = Middle_lit_font;

Nxingl.textcolor = text_hex_red_f95a;

[Nxingl mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.top.mas_equalTo (Namel.mas_top);

Make.left.mas_equalTo (Namel.mas_right);

}];

[Nxingl setcontenthuggingpriority:uilayoutpriorityrequired foraxis:uilayoutconstraintaxishorizontal];

for (int i = 0; i<self.arrleixing.count; i++) {

NSString *str = Self.arrleixing[i];

UIButton *b_tn = [UIButton Buttonwithtype:uibuttontypesystem];

[SELF.LEIXINGBKGV Addsubview:b_tn];

[B_tn settitle:str Forstate:uicontrolstatenormal];

B_tn.titleLabel.font = Middle_lit_font;

[B_tn Settitlecolor:text_hex_mid_gray Forstate:uicontrolstatenormal];

B_tn.layer.borderColor = bkg_hex_gray_c9. Cgcolor;

B_tn.layer.borderWidth = 1;

B_tn.tag = 1000+i;

[Self.arrbtn Addobject:b_tn];

[B_tn addtarget:self Action: @selector (CLICKEDWENTILEIXINGBTN:) forcontrolevents:uicontroleventtouchupinside];

[B_tn mas_makeconstraints:^ (Masconstraintmaker *make) {

Make.top.mas_equalTo (Shangv.mas_bottom). Mas_offset ((I/3) * (text_edge_distance+_btnheight) +text_edge_distance);

Make.left.mas_equalTo (Self.leiXingBkgV.mas_left). Mas_offset ((i%3) * (_btnwidth+text_edge_distance) +text_edge_ DISTANCE);

Make.size.mas_equalTo (Cgsizemake (_btnwidth, _btnheight));

}];

[B_tn layoutifneeded];

[SELF.LEIXINGBKGV mas_remakeconstraints:^ (Masconstraintmaker *make) {

Make.centerX.mas_equalTo (Self.contentView.mas_centerX);

Make.left.mas_equalTo (Self.contentView.mas_left);

Make.top.mas_equalTo (Self.contentView.mas_top);

&

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.