IOS - 購買類型視圖

來源:互聯網
上載者:User

IOS - 購買類型視圖

購買類型視圖定製

代碼

// 支付頁面格式- (UIView*) CellForRowAtRow:(NSInteger) row {    UIView* itemView = [UIView viewWithFrame: CGRectMake(0, 0, viewWidth() - 20, 45)                                  andBkColor: [UIColor clearColor]];    NIDASSERT(row < _alipayInfo.count);    if (row < _alipayInfo.count) {        // 會員訂用帳戶        UILabel* titleLabel = [UILabel labelWithFrame: CGRectMake(10, 15, 100, 15)                                             fontSize: 14                                            fontColor: RGBCOLOR_HEX(0x666666)                                                 text: _alipayInfo[row][@desc]];        [itemView addSubview: titleLabel];        // 價錢        CYAttributedLabel* pricelabel = [[CYAttributedLabel alloc] initWithFrame: CGRectMake(0, 12, 125, 20)];        pricelabel.verticalTextAlignment = NIVerticalTextAlignmentTop;        pricelabel.text = [NSString stringWithFormat: @%@元, _alipayInfo[row][@price]];        pricelabel.font = [UIFont boldSystemFontOfSize: 14];        pricelabel.textColor = RGBCOLOR_HEX(0xff6000);        [pricelabel setFont: [UIFont boldSystemFontOfSize: 11]                      range: [pricelabel.text rangeOfString: @元]];        pricelabel.textAlignment = NSTextAlignmentRight;        [itemView addSubview: pricelabel];        // 和原價的比較        CYAttributedLabel* originPriceLabel = [[CYAttributedLabel alloc] initWithFrame: CGRectMake(145, 16, 110, 18)];        originPriceLabel.font = [UIFont systemFontOfSize: 11];        originPriceLabel.verticalTextAlignment = NIVerticalTextAlignmentTop;        originPriceLabel.cssHandler = [CYResource getCssHandler];        originPriceLabel.text = _alipayInfo[row][@old_price];        originPriceLabel.textColor = RGBCOLOR_HEX(0x666666);        [itemView addSubview: originPriceLabel];        NSArray *array = [originPriceLabel.text componentsSeparatedByString:@ ];        // 劃線        UIView *lineView = [[UIView alloc] init];        lineView.backgroundColor = originPriceLabel.textColor;        [itemView addSubview:lineView];        UILabel *subLabel = [UILabel labelWithFrame:CGRectZero                                           fontSize:14                                          fontColor:[UIColor blackColor]                                               text:array[0]];        [subLabel sizeToFit];        lineView.frame = CGRectMake(originPriceLabel.left, originPriceLabel.top + 7, subLabel.width - 10, 1);        // 選中的按鈕        UIButton* button = [UIButton buttonWithBackgroundImage: @choose_icon_normal.png                                       selectedBackgroundImage: @choose_icon_selected.png                                                         frame: CGRectMake(viewWidth() - 50, 14, 20, 20)                                                        target: nil                                                      selector: nil];        [itemView addSubview: button];    }    return itemView;}

效果

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.