UISegmentedControl *segmentC = [[UISegmentedControl alloc]initWithItems:[NSArray arrayWithObjects:@"本週週報",@"歷史週報", nil]]; segmentC.frame = CGRectMake(0,0, 120, 30); segmentC.layer.borderColor = [UIColor whiteColor].CGColor; segmentC.layer.borderWidth = 1; segmentC.tintColor = [UIColor whiteColor]; segmentC.backgroundColor = [UIColor clearColor]; NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName,[UIFont systemFontOfSize:14],NSFontAttributeName,nil]; [segmentC setTitleTextAttributes:dic forState:UIControlStateNormal]; segmentC.layer.cornerRadius = 15.0f; segmentC.layer.masksToBounds = YES; segmentC.tintColor = [UIColor whiteColor]; self.navigationItem.titleView = segmentC;