iOS - 无法在按钮

时间:2018-01-18 00:04:06

标签: ios iphone xamarin xamarin.ios

使用Xamarin iOS,我的.xib中有一个按钮,定义为......

            <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="5" translatesAutoresizingMaskIntoConstraints="NO">
                <rect key="frame" x="76" y="361" width="262" height="45"/>
                <color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                <state key="normal" backgroundImage="images/buttongold.png" title="Please Wait...">
                    <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                </state>
                <connections>
                    <action selector="TakePictureClick:" destination="-1" eventType="touchUpInside" id="7"/>
                </connections>
                <constraints>
                    <constraint id="783" firstItem="5" firstAttribute="width" constant="262"/>
                    <constraint id="784" firstItem="5" firstAttribute="height" constant="45"/>
                </constraints>
            </button>

我正在尝试将按钮上的文字设置为启用和禁用...

    public override void ViewWillAppear(bool animated)
    {
        base.ViewWillAppear(animated);
        TakePictureButton.SetTitle("", UIControlState.Normal);
        TakePictureButton.SetTitle("Please Wait...", UIControlState.Disabled);
    }

所以,如果我有......

                TakePictureButton.Enabled = false;

按钮不应该正在阅读&#39;请等待......&#39;?

谢谢!

1 个答案:

答案 0 :(得分:1)

因此您将alpha的{​​{1}}设置为TintColor。它等于看不见。

What is tintColor on Button

  

应用于按钮标题和图像的色调颜色。

所以你需要在第3行修改xib,如下所示

0