小编Hit*_*rth的帖子

int,NSInteger和NSUInteger之间的区别

是什么之间的主要区别int,NSIntegerNSUInteger在Objective-C?

哪一个更适合在应用程序中使用?为什么?

iphone int objective-c nsinteger nsuinteger

36
推荐指数
2
解决办法
2万
查看次数

在Android图库中选择多个图像

我正在使用一个应用程序,它具有一个功能,可以从内置的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)

但我只能从图库中选择一个图像.所以请建议我如何从内置的库中选择多个图像.

提前致谢 !!!

android image-uploading android-gallery

10
推荐指数
1
解决办法
4万
查看次数

使用核心图形在绘图线中出现问题:显示气泡

使用核心图形,我试图绘制一条线,当我尝试添加阴影是在线内创建林和气泡,看到图像,我无法解决问题.请在下面找到我的代码

-(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)

iphone core-graphics objective-c ios5

10
推荐指数
1
解决办法
1364
查看次数

iOS 6问题将MPMediaItem转换为NSData

我曾尝试过以下代码.

   -(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)

iphone objective-c mpmediaitem avassetexportsession ios6

7
推荐指数
1
解决办法
4405
查看次数

检查Blackberry应用程序中的wifi状况

我开发了一个黑莓设备的应用程序.如果它通过数据服务提供商使用互联网,该应用程序正常工作.

我有BB 9550,我想使用我的应用程序使用wifi.我尝试了很多,但我无法得到正确的答案来检查无线电状况.

我们如何区分运行我们的WiFi或数据服务提供商的应用程序?

blackberry wifi

6
推荐指数
1
解决办法
1489
查看次数

以dd-mm-yyyy格式获取当前日期

如何DD-MM-YYYY在BlackBerry中获取格式的当前日期

我已经尝试了以下,但它给了我输出 1318502493

long currentTime = System.currentTimeMillis() / 1000;

System.out.println("Current time in :" + currentTime);
Run Code Online (Sandbox Code Playgroud)

blackberry date date-format java-me

6
推荐指数
2
解决办法
2万
查看次数

将日期从yyyy-mm-dd转换为日月日期

我有这种格式的约会2011-11-02.即日起,我们怎么能知道Day-of-week,Month而且Day-of-month,像这种格式Wednesday-Nov-02,从日历或任何其他方式?

blackberry date date-format java-me

5
推荐指数
1
解决办法
1853
查看次数

如何使用Core Graphics创建浮雕或阴影效果(用于手指画)

我有问题在我的绘图中实现"浮雕/阴影效果".手指绘画功能目前与我的自定义工作正常,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)

iphone core-graphics cgcontext ios cgcontextref

5
推荐指数
1
解决办法
979
查看次数

检查UIImage的问题是否具有alpha(透明)颜色

我正在检查图像是否有透明区域(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)

objective-c alpha-transparency uiimage ios

5
推荐指数
2
解决办法
1753
查看次数

如何使用OpenGL为UIImageView/uiview提供3D效果看起来像3D立方体

我是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 opengl-es core-graphics uiimageview

1
推荐指数
1
解决办法
944
查看次数