在iphone中创建阴影

在iphone中创建阴影,iphone,objective-c,ios,ipad,Iphone,Objective C,Ios,Ipad,我有一层,我需要上半部分的红色阴影 Shadow.startPoint = CGPointMake(0.5,0); Shadow.endPoint = CGPointMake(0.5,1); 我的代码是 Shadow.colors = [NSArray arrayWithObjects: (id)[[[UIColor redColor] colorWithAlphaComponent:0.6] CGColor],

我有一层,我需要上半部分的红色阴影

Shadow.startPoint = CGPointMake(0.5,0);
    Shadow.endPoint = CGPointMake(0.5,1);
我的代码是

Shadow.colors = [NSArray arrayWithObjects:
                               (id)[[[UIColor redColor] colorWithAlphaComponent:0.6] CGColor],
                               (id)[[UIColor clearColor] CGColor],
                               nil];
    Shadow.startPoint = CGPointMake(0,0.5);
    Shadow.endPoint = CGPointMake(1,0.5);
这给了我一个左半阴影。 我要做什么才能得到上半部分的红色阴影

Shadow.startPoint = CGPointMake(0.5,0);
    Shadow.endPoint = CGPointMake(0.5,1);

这解决了我的问题。谢谢Borrden

你有没有试着在你的CGPointMake中反转数字?