Stop interaction in IOS-UIView

Source: Internet
Author: User

Stop interaction in IOS-UIView

UIView stop interaction (no focus ):
Set userInteractionEnabled = NO to get the interaction settings YES.
It can be applied to custom controls such as UIButton and UITextField.

[editButton setUserInteractionEnabled:YES];editButton.userInteractionEnabled = NO;

Instance:

# Pragma mark ItemChooseViewDelegate // select the service type Box-(void) didSelectedItem {NIDPRINTMETHODNAME (); _ servicePos = _ serviceItemListView. selectedIndex; // set the Item location // total Price _ totalPrice = (float) ([_ goodsList [_ servicePos] [@ Price] floatValue]/100.0) * [[_ serviceNumList objectAtIndex: _ servicePos] integerValue]; [_ totalPriceLabel setText: [NSString stringWithFormat: @ % 0.1f, _ totalPrice]; // set the button status for (int I = 0; I <_ goodsList. count; ++ I) {// select if (I = _ servicePos) {[[_ titleLabelArray objectAtIndex: I] setTextColor: [UIColor blackColor]; [[_ priceLabelArray objectAtIndex: I] setTextColor: RGBCOLOR_HEX (0xff6000)]; [[_ timesFieldArray objectAtIndex: I] setTextColor: [UIColor blackColor]; [_ timesFieldArray objectAtIndex: i] setUserInteractionEnabled: YES]; [[_ addBtnArray objectAtIndex: I] setUserInteractionEnabled: YES]; [[_ subBtnArray objectAtIndex: I] setUserInteractionEnabled: YES]; continue ;} // [_ titleLabelArray objectAtIndex: I] setTextColor: [UIColor grayColor]; [_ priceLabelArray objectAtIndex: I] setTextColor: [UIColor grayColor] is not selected; [[_ timesFieldArray objectAtIndex: I] setTextColor: [UIColor grayColor]; [_ timesFieldArray objectAtIndex: I] setUserInteractionEnabled: NO]; [_ addBtnArray objectAtIndex: I] identifier: NO]; [[_ subBtnArray objectAtIndex: I] setUserInteractionEnabled: NO];}

 

Related Article

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.