Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

CPButton sizeToFit doesn't consider margins

#96


_okButton = [[CPButton alloc] initWithFrame:CPRectMake(0, 0, 0, 0)];
  [_okButton setTarget:_target];
  [_okButton setAction:_action];
  [_okButton setFont:[CPFont fontWithName:"Helvetica" size:16]];
  [_okButton setTitle:"OK"];
  [_okButton sizeToFit];
  [_okButton setFrameOrigin:CPPointMake(
      CPRectGetWidth([self bounds]) / 2 - CPRectGetWidth([_okButton bounds]) / 2,
      CPRectGetHeight([self bounds]) - Margin - CPRectGetHeight([_okButton bounds])
    )
  ];
  [self addSubview:_okButton];

See attached image for result

Reported by Rich Collins · October 8th, 2008 @ 09:53 AM

State: new
Milestone: none
Assigned to: nobody

Activity

No comments yet.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.