ios问题,如何将界面设置成不规则的九宫格形状
大家讲道理
大家讲道理 2017-04-17 13:02:44
[iOS讨论组]

就是打开应用的时候,进去的界面是一个不规则的九宫格,而且九块面积不一样,形状不同,点击不同的地方进入不同的页面实现不同的功能

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(2)
怪我咯

试试用 UICollectionView 实现?动态计算 cell 的宽高,形状的的不同用不同的背景图模拟,点击事件就用直接实现对应的 delegate 方法

ringa_lee

所谓九宫格也就是两条横线两条竖线划分出来的。
你可以随机生成4个随机数(范围10-40就差不多了),其中两个来作为竖线在屏幕的位置,另外两个作为横在屏幕的位置。

var a = Math.ceil(Math.random()*30)+10;
var b = Math.ceil(Math.random()*30)+10;
var c = Math.ceil(Math.random()*30)+10;
var d = Math.ceil(Math.random()*30)+10;
document.write('<table width="500" height="900" border="1"><tr>');
document.write('<td width="'+a+'%" height="'+b+'%"></td>');
document.write('<td width="'+c+'%"></td>');
document.write('<td></td>');
document.write('</tr><tr>');
document.write('<td height="'+d+'%"></td>');
document.write('<td></td>');
document.write('<td></td>');
document.write('</tr><tr>');
document.write('<td></td>');
document.write('<td></td>');
document.write('<td></td>');
document.write('</tr></table>');
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号