Ios table section header font

System Requirements: Windows 8, Windows 7, Windows 8.1


@ Harsh 's answer worked great for me, and by changing the coordinations of UILabel you can move it around. Also, I, personally thought to change the shadow offset a bit to make it more readable, but that could be a personal choice. Here's my version in case: - ( UIView table View UITable View table View view For Header In Section NSInteger)section NSString *section Title = [self table View:table View title For Header In Section:section]; if (section Title = nil) return nil; / Create label with section title UILabel *label = [ UILabel alloc] init With Frame: CGRect Make(40, -5, 300, 30)] autorelease]; / If you add a bit to x and decrease y, it will be more in line with the table View cell (that is in i Pad and landscape) label.background Color = [ UIColor clear Color]; label.text Color = [ UIColor yellow Color]; label.shadow Color = [ UIColor white Color]; label.shadow Offset = CGSize Make(0.5., 0.5. label.font = [ UIFont bold System Font Of Size:18]; label.text = section Title; / Create header view and add label as a subview UIView *view = [ UIView alloc] init With Frame: CGRect Make(0, 0, 320, Section Header Height)]autorelease]; [view add Subview:label]; return view;.
Very Similar to the technique used for - ( UITable View Cell table View UITable View table View cell For Row At Index Path NSIndex Path index Path You can create an instance of a cell prototype that you provide. If your cell includes an outlet for a label, you can set it before returning it: - ( UIView table View UITable View table View view For Header In Section NSInteger) section Session Table View Cell *cell; cell = [table View dequeue Reusable Cell With Identifier Session Section Header ]; if (cell = nil) cell = [ Session Table View Cell alloc] init With Style: UITable View Cell Style Default reuse Identifier Session Section Header ]; cell.my Label.text = my Titles[section]; return cell; Note that @ Session Section Header is the identifier in the storyboard for our cell prototype. HTH!.
Im struggling trying to style a UIView Header, I'm using IOS7 storyboard and custom cells - each of which has its own class - I would to achieve an opaque grey background with white text - Helvetica Neue Medium Font size 16 - the initial header is hidden in the Height For Header In Section method - So far I have - - ( UIView table View UITable View table View view For Header In Section NSInteger)section UIView *header View = [ UIView alloc] init With Frame: CGRect Make(0, 0, table View.bounds.size.width, 30)]; if (section = 0) [header View set Background Color:[ UIColor clear Color]; else [header View set Background Color:[ UIColor color With Red:156.0f/255.0f green:156.0f/255.0f blue:156.0f/255.0f alpha:0.75f]; [header View set Tint Color:[ UIColor white Color]; return header View; Update My Header text is taken from this method - - ( NSString table View UITable View table View title For Header In Section: ( NSInteger)section if(section = 1) return @ Offers ; else if(section = 2) return @ Workouts ; else return @ Weights ;.
Yes. It works great now! I created table View:view For Header In Section: method and created a UIView UIView *custom Title View = [ [ UIView alloc] init With Frame: CGRect Make(10, 0, 300, 44)]; Then i created a UILabel title Label.text = @ < Title string here> ; title Label.text Color = [ UIColor white Color]; title Label.background Color = [ UIColor clear Color]; [custom Title View add Subview:title Label]; So my table View:view For Header In Section: method looks like. -( UIView table View UITable View table View view For Header In Section NSInteger)section UIView *custom Title View = [ [ UIView alloc] init With Frame: CGRect Make(10, 0, 300, 44)]; UILabel *title Label = [ [ UILabel alloc] init With Frame: CGRect Make(0, 0, 300, 44)]; title Label.text = @ < Title string here> ; title Label.text Color = [ UIColor white Color]; title Label.background Color = [ UIColor clear Color]; [custom Title View add Subview:title Label]; return custom Title View; We should add table View:height For Header In Section: method for providing some space to the title. -( CGFloat)table View UITable View table View height For Header In Section NSInteger)section return 44;.
func table View(table View: UITable View, view For Header In Section section: Int) -> UIView? let h View = UIView(frame: CGRect Make(0, 0, table View.frame.width, 44) h View.background Color = UIColor.white Color let h Label = UILabel(frame: CGRect Make(15, 2, 30, 44) h Label.font = UIFont(name: YOUR_ FONT_ NAME, size: 30) h Label.text Color = ki Extreme Orange h Label.text = alphabets[section] h View.add Subview(h Label) return h View Note: First import the font you want to use.