小编Man*_*ani的帖子

How to crop the image using UIBezierPath?

I want to get the image from the UIBezierpath closed path(See the image). I draw the image on the UIView using drawRect method and also draw the lines are using the drawRect method. How can I get the particular closed path image? Please help me. Thanks in advance.

This code used for draw the bezierpath.

UIBezierPath *aPath = [UIBezierPath bezierPath];
for (NSString *pointString in pointArray) {
    if ([pointArray indexOfObject:pointString] == 0)
        [aPath moveToPoint:CGPointFromString(pointString)];
    else
        [aPath addLineToPoint:CGPointFromString(pointString)];
}
[aPath closePath];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

iphone objective-c ios uibezierpath

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

如何以编程方式检测iPhone中的EDGE网络或坏网络?

我需要检测iPhone中的EDGE网络和坏网络.

1)如何检测坏网络

2)是否有可能检测到EDGE网络

3)我如何获得网络的力量?

请对这些问题给出一些答案.提前致谢.

iphone networking ios

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

图像裁剪在iOS 6.0中无法正常工作.在模拟器中工作正常.

- (UIImage *)imageByCropping:(UIImage *)imageToCrop toRect:(CGRect)rect
{
    CGImageRef imageRef = CGImageCreateWithImageInRect([imageToCrop CGImage], rect);
    UIImage *cropped = [UIImage imageWithCGImage:imageRef];
    CGImageRelease(imageRef);
    return cropped;
}
Run Code Online (Sandbox Code Playgroud)

我正在使用此代码.请给出一些解决方案.谢谢

iphone

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

如何用xib创建UIView子类?

我想一般创建UIView.并在所有视图控制器中使用该视图.如何使用xib创建UIView子类并在所有视图控制器中使用?提前致谢.

iphone xcode uiview ios

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

如何在应用程序的后台运行计时器?

我想减少时间的倒计时.因此,如果用户最小化应用,则应用加载背景.如何在应用程序后台运行计时器?我使用以下代码.当app最小化时,计时器停止.请帮我.

        timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerCountDown) userInfo:nil repeats:YES];

- (void)timerCountDown
{
    if(secondsLeft > 0 ) {
        secondsLeft -- ;
        hours = secondsLeft / 3600;
        minutes = (secondsLeft % 3600) / 60;
        seconds = (secondsLeft %3600) % 60;
    }
}
Run Code Online (Sandbox Code Playgroud)

iphone

4
推荐指数
2
解决办法
6214
查看次数

iOS 6.0 MPMoviePlayerController全屏模式黑色?然后App阻止了更多动作

MPMoviePlayerController视频在屏幕为黑色时进入全屏模式.然后应用程序被阻止了.此问题仅适用于iOS 6.0.但iOS 5.1工作正常.这是我的代码.如果我双击播放器全屏打开,但显示黑屏.

 self.moviePlayerController = [[MPMoviePlayerController alloc] init];
[self.moviePlayerController.view setFrame:_moviePlayerContentView.bounds]; 
[self.moviePlayerController setControlStyle:MPMovieControlStyleNone];
[self.moviePlayerController setAllowsAirPlay:NO];
[_moviePlayerContentView addSubview:self.moviePlayerController.view];
[self.moviePlayerController stop];
[self.moviePlayerController setContentURL:videoURL];
[self.moviePlayerController.view setHidden:NO];
[self.moviePlayerController prepareToPlay];
[self.moviePlayerController play];
Run Code Online (Sandbox Code Playgroud)

我该如何处理这个问题?

达到MPMovieFinishReasonPlaybackEnded后,如何禁用全屏模式?

请帮我.提前致谢.

iphone xcode mpmovieplayercontroller ios6

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

如何在UIImageView上绘制线条而不是UIView?

如何在UIImageView上画一条线?我正在使用UIImageView子类,它不支持drawRect:方法.我想在图像视图上画一条线.我怎样才能做到这一点?请帮我.我在下面的代码中使用绘制线.

- (void)drawRect:(CGRect)rect {
    CGContextRef c = UIGraphicsGetCurrentContext();

    CGFloat red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
    CGContextSetStrokeColor(c, red);
    CGContextBeginPath(c);
    CGContextMoveToPoint(c, 5.0f, 5.0f);
    CGContextAddLineToPoint(c, 50.0f, 50.0f);
    CGContextStrokePath(c);
}
Run Code Online (Sandbox Code Playgroud)

iphone uiimageview ios

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