关于UGUI RectTransform的几个参数的获取和修改(待补充)
2015-07-07 14:50
351 查看
1.改变RectTransform的top
GetComponent<RectTransform>().offsetMax = new Vector2(GetComponent<RectTransform>().offsetMax.x, top);
2.改变RectTransform的bottom
GetComponent<RectTransform>().offsetMin = new Vector2(GetComponent<RectTransform>().offsetMin.x, bottom);
3.改变RectTransform的width,height
GetComponent<RectTransform>().sizeDelta = new Vector2(width, height);
4.改变RectTransform的pos
GetComponent<RectTransform>().anchoredPosition3D = new Vector3(posx,posy,posz);
GetComponent<RectTransform>().anchoredPosition = new Vector2(posx,posy);
GetComponent<RectTransform>().offsetMax = new Vector2(GetComponent<RectTransform>().offsetMax.x, top);
2.改变RectTransform的bottom
GetComponent<RectTransform>().offsetMin = new Vector2(GetComponent<RectTransform>().offsetMin.x, bottom);
3.改变RectTransform的width,height
GetComponent<RectTransform>().sizeDelta = new Vector2(width, height);
4.改变RectTransform的pos
GetComponent<RectTransform>().anchoredPosition3D = new Vector3(posx,posy,posz);
GetComponent<RectTransform>().anchoredPosition = new Vector2(posx,posy);
相关文章推荐
- 连接池 druid(阿里巴巴的框架)
- string和stringbuilder区别
- IOS学习之旅-UI基础设置
- leetcode 日经贴,Cpp code -Implement Queue using Stacks
- 【iOS发展-70】点菜系统案例:使用文本框inputView和inputAccessoryView串联UIPickerView、UIDatePicker和UIToolBar
- 此请求已被阻止,因为当用在 GET 请求中时,会将敏感信息透漏给第三方网站。若要允许 GET 请求,请将 JsonRequestBehavior 设置为 AllowGet。
- Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面
- MySQL数据库中tinyint字段值为1,读取出来为true的问题
- easyui常现错误
- UESTC OJ 1647Battery Charging 模拟题
- funuiTitle-居中问题修改
- iOS开发之UITableView的滚动优化以及隐藏特性的使用
- JUnit学习之hamcrest、testSuite介绍及测试原则
- [LeetCode] Implement Queue using Stacks
- JAVA中request.getParameterMap()用法笔记
- easyui-tab 加载右键菜单
- error: stable identifier required, but $iwC.this.$VAL4.sqlContext found.
- android&nbsp;UI&nbsp;推荐
- android项目中values中几个文件的…
- iOS8中的UIAlertController