Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

目前 layout 中含有 selected 属性; 建议再增加一个 highlighted 属性;(有的时候需要通过监听点击事件,设置子视图的状态) #141

Open
kchtin opened this issue Jun 9, 2021 · 0 comments

Comments

@kchtin
Copy link

kchtin commented Jun 9, 2021

///设置触摸时的高亮

  • (void)mySetTouchHighlighted {
    if (self.highlightedOpacity != 0) {
    _oldAlpha = self.layout.alpha;
    self.layout.alpha = 1 - self.highlightedOpacity;
    }

    if (self.highlightedBackgroundColor != nil) {
    _oldBackgroundColor = self.layout.backgroundColor;
    self.layout.backgroundColor = self.highlightedBackgroundColor;
    }

    if (self.highlightedBackgroundImage != nil) {
    _oldBackgroundImage = self.layout.backgroundImage;
    self.layout.backgroundImage = self.highlightedBackgroundImage;
    }
    }

//恢复触摸时的高亮。

  • (void)myResetTouchHighlighted {
    if (self.highlightedOpacity != 0) {
    self.layout.alpha = _oldAlpha;
    _oldAlpha = 1;
    }

    if (self.highlightedBackgroundColor != nil) {
    self.layout.backgroundColor = _oldBackgroundColor;
    _oldBackgroundColor = nil;
    }

    if (self.highlightedBackgroundImage != nil) {
    self.layout.backgroundImage = _oldBackgroundImage;
    _oldBackgroundImage = nil;
    }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant