Iphone 是",;X";SDK主屏幕部分的删除按钮?
因此,当你想从主屏幕上删除一个应用程序,或者从iBooks上删除一本书时,当你进入“编辑模式”时,在应用程序图标/书/任何东西的左上角都会有一个小小的X位 这个按钮是SDK的一部分吗Iphone 是",;X";SDK主屏幕部分的删除按钮?,iphone,image,button,ibooks,Iphone,Image,Button,Ibooks,因此,当你想从主屏幕上删除一个应用程序,或者从iBooks上删除一本书时,当你进入“编辑模式”时,在应用程序图标/书/任何东西的左上角都会有一个小小的X位 这个按钮是SDK的一部分吗 而且。。。如果没有(我很确定没有),有人知道可能包含X图像的Apple示例项目吗?如果您想使用此图像,只需: 从某处剪下来 使用photoshop使背景透明 将图像添加到自定义UIButton 抱歉,我不记得有任何项目使用过它…您可以尝试在Springboard.app中查找。(Springboard是iOS的
而且。。。如果没有(我很确定没有),有人知道可能包含X图像的Apple示例项目吗?如果您想使用此图像,只需:
- 从某处剪下来
- 使用photoshop使背景透明
- 将图像添加到自定义UIButton
抱歉,我不记得有任何项目使用过它…您可以尝试在Springboard.app中查找。(Springboard是iOS的主屏幕。)它应该位于以下位置:
/开发者/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*X.Y.Z*.sdk/System/Library/CoreServices/SpringBoard.app/ 编辑:根据下面的注释,4.1模拟器sdk的图像位置为:
/开发者/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/CoreServices/SpringBoard.app/closebox.png/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/CoreServices/SpringBoard.app/closebox\@2x.png如果您有兴趣使用石英绘制此图,以下代码是从我创建的CALayer中提取的,用于呈现这种删除按钮:
#define SPACETOEXPANDDELETELAYERFORSHADOW 4.0f
#define FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES 0.38
- (void)renderAsVectorInContext:(CGContextRef)context;
{
if (strokeColor == NULL)
return;
CGContextSetLineJoin(context, kCGLineJoinBevel);
CGContextSetStrokeColorWithColor(context, strokeColor);
CGContextSetLineWidth(context, strokeWidth);
CGContextSetLineCap(context, kCGLineCapRound);
CGRect currentFrame = self.bounds;
currentFrame = CGRectInset(currentFrame, SPACETOEXPANDDELETELAYERFORSHADOW, SPACETOEXPANDDELETELAYERFORSHADOW);
CGContextSetShadow(context, CGSizeMake(2.0f, 2.0f), 2.0f);
CGContextFillEllipseInRect(context, CGRectMake(currentFrame.origin.x + strokeWidth, currentFrame.origin.y + strokeWidth, currentFrame.size.width - (2.0f * strokeWidth), currentFrame.size.height - (2.0f * strokeWidth)));
CGContextStrokeEllipseInRect(context, CGRectMake(currentFrame.origin.x + strokeWidth, currentFrame.origin.y + strokeWidth, currentFrame.size.width - (2.0f * strokeWidth), currentFrame.size.height - (2.0f * strokeWidth)));
CGContextSetLineWidth(context, 1.3f * strokeWidth);
CGContextBeginPath(context);
CGContextMoveToPoint(context, currentFrame.origin.x + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.width, currentFrame.origin.y + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.height);
CGContextAddLineToPoint(context, currentFrame.origin.x + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.width, currentFrame.origin.y + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.height);
CGContextMoveToPoint(context, currentFrame.origin.x + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.width, currentFrame.origin.y + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.height);
CGContextAddLineToPoint(context, currentFrame.origin.x + FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES * currentFrame.size.width, currentFrame.origin.y + (1.0f - FRACTIONOFVIEWFORSTARTANDSTOPOFCROSSLINES) * currentFrame.size.height);
CGContextStrokePath(context);
}
在这种情况下,
strokeColor
是一个白色的CGColorRef,图层为31 x 31,而strokeWidth
为2.0。/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.4.1.sdk/System/Library/CoreServices/SpringBoard.app/closebox.png/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.4.1.sdk/System/Library/Library/CoreServices/SpringBoard.app\@2x.pngIt值得注意的是,苹果并没有让这些无处不在的图标在SDK中更容易访问,就像Android中的标准图标一样