如何在textField iOS 7中创建innerShadow?

时间:2013-10-01 20:25:28

标签: ios uitextfield ios7 textfield xcode5

从iOS 7开始,我的textField不会像在早期版本的iOS中那样自动“阴影”。我想在文本字段中添加一个innerShadow。从iOS 7开始,这是最好的方法吗?下面的代码是我如何编码我的textField。你可以在这里看到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;
            }

        }

    }

1 个答案:

答案 0 :(得分:0)

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

相关问题