How to make a Rectangle button?

Discussion in 'iOS Programming' started by mikezang, Nov 5, 2010.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    Apple only provide rounded-corner button, but I need some rectangle buttons, what can I do? is there any simpler way to create rectangle button? I think custom style button might be a nice choice, but I am not sure how to implement it in detail.
    Please give me some hint or suggestion.
     
  2. ritsard macrumors regular

    ritsard

    Joined:
    Jun 18, 2009
    Location:
    SF Bay Area, CA
    #2
    You can set a borderless button in IB and set the image background to a rectangle.
     
  3. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    I want to create buttons in programming, is it possible?

    By the way, do you know how to create a button looks like the buttons on standard ipad keyboard with the same color and alpha value?
     
  4. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    Mike, I think if you look at the UIButton documentation you can find the api to create a custom button in code.

    I don't see that those buttons have any special alpha value. Most likely is 1.0. Why do you think it's something else? With a screenshot and and Photoshop or similar app you should be able to figure out the colors. If the buttons have a gradient though you'll need to do more work.
     
  5. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    Thanks, I created custom button.

    Do you think if on-screen keyboard's buttons have gradient?
     
  6. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #6
    I used GIMP to pick up color of on-screen keyboard buttons and make a background image and set to my button, but they are different, why?
     

    Attached Files:

  7. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #7
    There is a utility on your Mac called DigitalColor Meter. It's in the Utilities folder. Finder : Go menu > Utilities item.

    When you run it and move your cursor over the simulator window's buttons, it becomes clear that the normal keyboard has top-to-bottom gradients on its keys and its background.

    Also, if you look at the simulator's pixels in DigitalColor Meter's magnified area, it's clear the normal keyboard buttons have a border and a shadow, while yours don't.
     
  8. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #8
    Thanks for your information, I just found it is gradient button, but I didn't know the DigitalColor Meter.
     

Share This Page