【问题标题】:How to create innerShadow in textField iOS 7?如何在 textField iOS 7 中创建 innerShadow?
【发布时间】:2013-10-01 20:25:27
【问题描述】:

从 iOS 7 开始,我的 textField 将不会像在早期版本的 iOS 中那样自动被“遮蔽”。我想在文本字段中添加一个 innerShadow。自 iOS 7 以来最好的方法是什么?下面的代码是我如何编码我的文本字段。你可以在这里看到 iOS 7 和 iOS 6 的区别:http://tinypic.com/view.php?pic=2ufewx0&s=5#.Uksu6hbU-8V

 UITextField* sbTextField;

    //[sbTextField removeFromSuperview];
    for (UIView *subView in self.searchBar.subviews){
        for (UIView *ndLeveSubView in subView.subviews){

            if ([ndLeveSubView isKindOfClass:[UITextField class]])
            {
                sbTextField = (UITextField *)ndLeveSubView;

                sbTextField.backgroundColor =[UIColor whiteColor];

                self.navigationItem.titleView = sbTextField;
                self.navigationItem.rightBarButtonItem =  menuButton;
                // [sbTextField removeFromSuperview];

                break;
            }

        }

    }

【问题讨论】:

    标签: ios uitextfield ios7 textfield xcode5


    【解决方案1】:

    您可以尝试this approach 并将半径设为负数(我只是在猜测)。此外,如果它在动画的超级视图中(例如 tableview),这可能会导致渲染问题并使其非常慢。

    【讨论】:

      猜你喜欢
      • 2014-04-06
      • 2019-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多