代码之家  ›  专栏  ›  技术社区  ›  Pugalmuni Tom Tharakan

如何在iPhone的UISegmented控件中创建纯背景

  •  1
  • Pugalmuni Tom Tharakan  · 技术社区  · 14 年前

     segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
    

    我得到了这样的结果,

    Image-1 http://www.freeimagehosting.net/uploads/3d98eda2bd.png

    但我想用这样的片段做背景, Image-2 http://www.freeimagehosting.net/uploads/efe195f809.png

    因此,有可能创建一个简单的背景段。请引导我,如果这是不可能的,请给我一些替代建议。

    提前谢谢。

    好斗的

    1 回复  |  直到 14 年前
        1
  •  0
  •   koopajah MKumar    11 年前
    UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:[NSArray
                                       arrayWithArray:temp]];
    
    [segment setFrame:CGRectMake(0, 0, width, 30.0)];
    
    [segment setSegmentedControlStyle: UISegmentedControlStyleBar];
    
    [segment setTintColor:[UIColor redColor]];
    
    [segment setSelectedSegmentIndex:0];
    

    如果设置TintColor,您的UISegmentedControl样式必须是“UISegmentedControlStyleBar”