Thursday, August 25, 2011

iPhone CGRectMake Example

Lets say I have CGRect on my iPhone screen as shown below in the screenshot with origin on the top left as usual. First question: How to create a rectangle using iPhone SDK. Code snippet is given below.




















   CGRect b=CGRectMake(40, 50, 240, 150);






Now what all information I can extract from it using iPhone SDK. You can find info/code in following articles.


1. Find Height and Width of CGRect.




2. Find All Coordinates of CGRect




3. Find if CGRect contains a point




4.Find if a CGRect intersects another CGRect




5.Find if  a CGRect contains another CGRect




6. Find intersecting area of 2 CGRects




7.How to divide a CGRect using CGRectDivide



3 comments:

  1. Nice post! Can’t wait for the next one. Keep stuff like this coming.
    Asus Laptops

    ReplyDelete
  2. Thanks for sharing information.
    online recharge
    Existing customers can avail the tariff benefit of ALL LOCAL CALLS at 25P/min for 3 months on Special Tariff voucher (STV)priced at Rs 38 only in Haryana.

    ReplyDelete