如何在不丢失连接的情况下重命名IBOutlet属性 [英] How to rename the IBOutlet property without lose the connection

查看:96
本文介绍了如何在不丢失连接的情况下重命名IBOutlet属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用旧项目,在项目的某些部分,命名约定并不好,所以我想更改它。

例如:

I work with old project and in some part of the project, the naming convention is not good so I want to change it.
For example:

@property (weak, nonatomic) IBOutlet UIButton *btnRequestCode;
rename it to -> @property (weak, nonatomic) IBOutlet UIButton *requestCodeButton;

我知道我可以删除 IBOutlet 然后重新连接,但如果不小心可能需要很多时间而且容易犯错误

I know that I can delete the IBOutlet then reconnect but it may take many time and easy make error if careless

任何安全快捷的方法吗?

Any safe and fast way to do it?

我尝试过Refactor - > Rename但它不起作用并给我一个警告

I have tried Refactor -> Rename but it doesn't work and give me an warning

任何帮助或建议都会非常感激。

Any help or suggestion would be great appreciated.

推荐答案

这就是我的意思通常做


  1. 右键单击IBOutlet名称,然后选择在工作区中查找所选文本

  1. Right Click the IBOutlet name,then selected Find Selected Text in Workspace


  1. 点击查找,然后选择替换

  1. Click find,then selected replace

3.替换为您想要的名称

3.Replace to the name you want

4.如果您确定,可以点击全部替换。您还可以单击预览以替换每个更改

4.You can click Replace All if you are sure. You can also to click preview to Replace every single change

这篇关于如何在不丢失连接的情况下重命名IBOutlet属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆