<span style="font-size:18px;"><code class="hljs vhdl has-numbering"> UILabel *<span class="hljs-keyword">label</span> = [[UILabel alloc]initWithFrame:CGRectMake(<span class="hljs-number">10</span>, <span class="hljs-number">10</span>, <span class="hljs-number">110</span>, <span class="hljs-number">150</span>)]; <span class="hljs-keyword">label</span>.backgroundColor = [UIColor orangeColor]; [self.view addSubview:<span class="hljs-keyword">label</span>]; <span class="hljs-comment">/* <span style="color:#FF0000;"><span style="background-color: rgb(255, 255, 255);"> CGRectGetHeight返回label本身的高度 CGRectGetMinY返回label顶部的坐标 CGRectGetMaxY 返回label底部的坐标 CGRectGetMinX 返回label左边缘的坐标 CGRectGetMaxX 返回label右边缘的坐标 CGRectGetMidX表示得到一个frame中心点的X坐标 CGRectGetMidY表示得到一个frame中心点的Y坐标</span></span> */</span> NSLog(@<span class="hljs-string">"CGRectGetHeight--%f"</span>, CGRectGetHeight(<span class="hljs-keyword">label</span>.frame)); NSLog(@<span class="hljs-string">"CGRectGetMaxX--%f"</span>, CGRectGetMaxX(<span class="hljs-keyword">label</span>.frame)); NSLog(@<span class="hljs-string">"CGRectGetMaxY--%f"</span>, CGRectGetMaxY(<span class="hljs-keyword">label</span>.frame)); NSLog(@<span class="hljs-string">"CGRectGetMidX--%f"</span>, CGRectGetMidX(<span class="hljs-keyword">label</span>.frame)); NSLog(@<span class="hljs-string">"CGRectGetMidY--%f"</span>, CGRectGetMidY(<span class="hljs-keyword">label</span>.frame)); NSLog(@<span class="hljs-string">"CGRectGetMinX--%f"</span>, CGRectGetMinX(<span class="hljs-keyword">label</span>.frame)); NSLog(@<span class="hljs-string">"CGRectGetMinY--%f"</span>, CGRectGetMinY(<span class="hljs-keyword">label</span>.frame)); <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.577</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetHeight<span class="hljs-comment">--150.000000</span> <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.577</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetMaxX<span class="hljs-comment">--120.000000</span> <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.577</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetMaxY<span class="hljs-comment">--160.000000</span> <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.577</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetMidX<span class="hljs-comment">--65.000000</span> <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.578</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetMidY<span class="hljs-comment">--85.000000</span> <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.578</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetMinX<span class="hljs-comment">--10.000000</span> <span class="hljs-number">2015</span>-<span class="hljs-number">04</span>-<span class="hljs-number">24</span> <span class="hljs-number">15</span>:<span class="hljs-number">39</span>:<span class="hljs-number">15.578</span> webView[<span class="hljs-number">15743</span>:<span class="hljs-number">677046</span>] CGRectGetMinY<span class="hljs-comment">--10.000000</span></code></span>
CGRectGetMaxX/Y 使用
最新推荐文章于 2023-03-21 21:46:21 发布