Single-camera for iphone Development

Source: Internet
Author: User

// Draw

-(Void) addSecondZone :( UIView *) contentView


// Button Image

UIImage * selecticonNo = [UIImage imageNamed: SelecticonNo];

UIImage * selecticon = [UIImage imageNamed: Selecticon];

UIView * childSecondView;

Childseconddview = [[UIView alloc] initWithFrame: CGRectMake (0,155,320,500)];

 


Int pointY = 0;

For (int I = 0; I <4; I ++ ){

[ChildSecondView addSubImageView: contentbar Rect: CGRectMake (0, pointY, 320, contentbar. size. height/2)];


UIButton * button = [UIButton buttonWithType: UIButtonTypeCustom];

[Button setBackgroundImage: selecticonNo forState: UIControlStateNormal];

[Button setBackgroundImage: selecticon forState: UIControlStateSelected];

Button. frame = CGRectMake (310-selecticonNo.size.width/2, pointY + 2, selecticonNo. size. width/2, selecticonNo. size. height/2 );

[Button setTitleColor: [UIColor blackColor] forState: UIControlStateNormal];

Button. tag = I + 1;

[Button addTarget: self action: @ selector (selectTransType :) forControlEvents: UIControlEventTouchUpInside];

If (I = 0)

{

[Button setSelected: YES];

}

[ChildSecondView addSubview: button];


PointY + = 40;

}

}

// Single click

-(Void) selectTransType :( id) sender

{

 


// Single button

UIImage * selecticonNo = [UIImage imageNamed: SelecticonNo];

UIImage * selecticon = [UIImage imageNamed: Selecticon];

UIButton * btn = nil;

 


For (int I = 1; I <5; I ++ ){

Btn = (UIButton *) [mainZone viewWithTag: I]; // obtain the single-choice button. mainZone is the outermost view.

If ([btn isSelected]) {

[Btn setBackgroundImage: selecticonNo forState: UIControlStateNormal];

[Btn setSelected: NO];

}

}

[Sender setBackgroundImage: selecticon forState: UIControlStateSelected];

[Sender setSelected: YES];


}

 

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.