Wednesday, January 21, 2015

Re: Is it really best practise to create frames with fixed size?

Oh, thanks. I thought this list is managed by apple so it's related to
cocoa frame work.
I'll take it to the other list
On Mon, Jan 19, 2015 at 11:47 PM, Fritz Anderson
<fritza@manoverboard.org> wrote:
> On Jan 19, 2015, at 8:40 AM, Aaron Lewis <the.warl0ck.1989@gmail.com> wrote:
>
>> I'm trying to create a button programatically, something similar to this:
>>
>> UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
>> [button setTitle:@"Click Me!" forState:UIControlStateNormal];
>> button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
>> [self.view addSubview: button];
>>
>> I had to set the frame otherwise it's invisible. And I'm using a fixed
>> size here.
>>
>> Is that best practise to do it? I'm wondering if there's a "standard" size
>
> 1. The object has to have _some_ size and location. Presumably you know what they should be. Suit yourself.
>
> 2. The frame is never really "fixed;" if you don't know what it should eventually be, setting it by whim and doing the arithmetic later is the only way. I use 0,0,100,100 for throwaway. Maybe my code would be cleaner if I declared a global const/let CGRect with a name that flags my intent that it be arbitrary.
>
> 3. Remember 44x44 points is the minimum usable size.
>
> 4. I am in the antisocial habit of answering off-topic questions. Help me reform: Take the next one to cocoa-dev, which is about UIKit practice, and not to a list restricted to Objective-C as a general-purpose programming language.
>
> ― F
>

--
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (Objc-language@lists.apple.com)