CALayer *TopBorder = [CALayer layer]; TopBorder.frame = CGRectMake(0.0f, 0.0f, myview.frame.size.width, 3.0f); TopBorder.backgroundColor = [UIColor redColor].CGColor; [myview.layer addSublayer:TopBorder];