是什么之间的主要区别int,NSInteger而NSUInteger在Objective-C?
哪一个更适合在应用程序中使用?为什么?
我正在使用一个应用程序,它具有一个功能,可以从内置的android中选择多个图像Gallery/Camera.
使用以下代码成功打开图库.
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE);
Run Code Online (Sandbox Code Playgroud)
但我只能从图库中选择一个图像.所以请建议我如何从内置的库中选择多个图像.
提前致谢 !!!
使用核心图形,我试图绘制一条线,当我尝试添加阴影是在线内创建林和气泡,看到图像,我无法解决问题.请在下面找到我的代码
-(void)drawRect:(CGRect)rect
{
[curImage drawAtPoint:CGPointMake(0, 0)];
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint mid2 = midPoint(currentPoint, previousPoint1);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.layer renderInContext:context];
CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.lineWidth);
CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor);
CGContextSetShadow(context, CGSizeMake(-16.00, -5.0f), 5.0f);
CGContextStrokePath(context);
[super drawRect:rect];
[curImage release];
}
Run Code Online (Sandbox Code Playgroud)
以下是touchesMoved方法.
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
previousPoint2 = previousPoint1;
previousPoint1 = [touch previousLocationInView:self];
currentPoint = [touch locationInView:self];
// calculate mid point
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint …Run Code Online (Sandbox Code Playgroud) 我曾尝试过以下代码.
-(void)mediaItemToData : (MPMediaItem * ) curItem
{
NSURL *url = [curItem valueForProperty: MPMediaItemPropertyAssetURL];
AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL: url options:nil];
AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset
presetName:AVAssetExportPresetPassthrough];
exporter.outputFileType = @"public.mpeg-4";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * myDocumentsDirectory = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSString *exportFile = [myDocumentsDirectory stringByAppendingPathComponent:
@"exported.mp4"];
NSURL *exportURL = [NSURL fileURLWithPath:exportFile];
exporter.outputURL = exportURL;
// do the export
// (completion handler block omitted)
[exporter exportAsynchronouslyWithCompletionHandler:
^{
NSData *data = …Run Code Online (Sandbox Code Playgroud) 我开发了一个黑莓设备的应用程序.如果它通过数据服务提供商使用互联网,该应用程序正常工作.
我有BB 9550,我想使用我的应用程序使用wifi.我尝试了很多,但我无法得到正确的答案来检查无线电状况.
我们如何区分运行我们的WiFi或数据服务提供商的应用程序?
如何DD-MM-YYYY在BlackBerry中获取格式的当前日期
我已经尝试了以下,但它给了我输出 1318502493
long currentTime = System.currentTimeMillis() / 1000;
System.out.println("Current time in :" + currentTime);
Run Code Online (Sandbox Code Playgroud) 我有这种格式的约会2011-11-02.即日起,我们怎么能知道Day-of-week,Month而且Day-of-month,像这种格式Wednesday-Nov-02,从日历或任何其他方式?
我有问题在我的绘图中实现"浮雕/阴影效果".手指绘画功能目前与我的自定义工作正常,UIView下面是我的drawRect方法代码:
使用所有方法编辑代码:
- (void)drawRect:(CGRect)rect
{
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint mid2 = midPoint(currentPoint, previousPoint1);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.layer renderInContext:context];
CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context, previousPoint1.x, previousPoint1.y, mid2.x, mid2.y);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, self.lineWidth);
CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor);
CGContextSaveGState(context);
// for shadow effects
CGContextSetShadowWithColor(context, CGSizeMake(0, 2),3, self.lineColor.CGColor);
CGContextStrokePath(context);
[super drawRect:rect];
}
CGPoint midPoint(CGPoint p1, CGPoint p2)
{
return CGPointMake((p1.x + p2.x) * 0.5, (p1.y + p2.y) * 0.5);
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject]; …Run Code Online (Sandbox Code Playgroud) 我正在检查图像是否有透明区域(alpha).在此基础上,我必须改变颜色UIImage
我已经实现了以下方法来检查图像是否有alpha.
- (BOOL) checkAlpha : (UIImage*) image
{
for(int x = 0; x < image.size.width ; x++)
{
for(int y = 0; y < image.size. height; y++)
{
CFDataRef pixelData = CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage));
const UInt8* data = CFDataGetBytePtr(pixelData);
int pixelInfo = ((image.size.width * y) + x ) * 4; // The image is png
UInt8 red = data[pixelInfo]; // If you need this info, enable it
UInt8 green = data[(pixelInfo + 1)]; // If you need this …Run Code Online (Sandbox Code Playgroud) 我是OpenGL的新手,对此并不了解.我想添加一个3D效果的UIImageView.如何使用OpenGL实现这一目标?我想做一些像这张图片中看到的东西:
我搜索过并发现可以使用OpenGL.我已经用OpenGL 引用了这个链接.我创建了一个立方体,并取得了一些效果
glDrawElements(GL_TRIANGLES, sizeof(Indices)/sizeof(Indices[0]), GL_UNSIGNED_BYTE, 0);
Run Code Online (Sandbox Code Playgroud)
但是我用glDrawRangeElements来了解我们可以创建一个3d立方体,但是我不知道如何实现它.
编辑
这是我的代码显示ther vertext和索引数组
const Vertex Vertices [] = {
// Front
{{1, -1, 1}, {1, 0, 0, 1}, {1, 0}},
{{1, 1, 1}, {0, 1, 0, 1}, {1, 1}},
{{-1, 1, 1}, {0, 0, 1, 1}, {0, 1}},
{{-1, -1, 1}, {0, 0, 0, 1}, {0, 0}},
// Back
{{1, 1, -1}, {1, 0, 0, 1}, {0, 1}},
{{-1, -1, -1}, {0, …Run Code Online (Sandbox Code Playgroud) iphone ×5
objective-c ×4
blackberry ×3
date ×2
date-format ×2
ios ×2
java-me ×2
android ×1
cgcontext ×1
cgcontextref ×1
int ×1
ios5 ×1
ios6 ×1
mpmediaitem ×1
nsinteger ×1
nsuinteger ×1
opengl-es ×1
uiimage ×1
uiimageview ×1
wifi ×1