我正在使用此代码捕获图像
#pragma mark - image capture
// Create and configure a capture session and start it running
- (void)setupCaptureSession
{
NSError *error = nil;
// Create the session
AVCaptureSession *session = [[AVCaptureSession alloc] init];
// Configure the session to produce lower resolution video frames, if your
// processing algorithm can cope. We'll specify medium quality for the
// chosen device.
session.sessionPreset = AVCaptureSessionPresetMedium;
// Find a suitable AVCaptureDevice
AVCaptureDevice *device = [AVCaptureDevice
defaultDeviceWithMediaType:AVMediaTypeVideo];
// Create a device input with the …
Run Code Online (Sandbox Code Playgroud) 我有一个UIView
使用CALayer
变换旋转的对象:
// Create uiview object.
UIImageView *block = [[UIImageView alloc] initWithFrame....]
// Apply rotation.
CATransform3D basicTrans = CATransform3DIdentity;
basicTrans.m34 = 1.0/-distance;
blockImage.layer.transform = CATransform3DRotate(basicTrans, rangle, 1.0f, 0.0f, 0.0f);
Run Code Online (Sandbox Code Playgroud)
旋转后,对象的边缘不会抗锯齿.我需要反他们.请帮帮我.怎么做到呢?
嗨我想设置AV
捕获会话以使用iphone相机捕获具有特定分辨率(如果可能,具有特定质量)的图像.这是setupping AV
会话代码
// Create and configure a capture session and start it running
- (void)setupCaptureSession
{
NSError *error = nil;
// Create the session
self.captureSession = [[AVCaptureSession alloc] init];
// Configure the session to produce lower resolution video frames, if your
// processing algorithm can cope. We'll specify medium quality for the
// chosen device.
captureSession.sessionPreset = AVCaptureSessionPresetMedium;
// Find a suitable AVCaptureDevice
NSArray *cameras=[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
AVCaptureDevice *device;
if ([UserDefaults camera]==UIImagePickerControllerCameraDeviceFront)
{
device =[cameras objectAtIndex:1];
}
else …
Run Code Online (Sandbox Code Playgroud) 我有一个应用程序需要获取设备上已安装(其他可能是第三方)应用程序的列表.怎么做到呢?或者它可以完成吗?
我有一个UITableView.每一行都是带有视频,图像等的重物.当用户滚动此视图时,如何释放不可见行的内存并加载当前可见的行?
我需要在 UITableView 中实现某种延迟加载。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//... some initializations here
//this is a function that pulls my cell data using helper class
NSData *cellData=[MyDataClass dataForCellAtIndexPath:indexpath.row];
//... here I populate pulled data to cell
return cell;
}
Run Code Online (Sandbox Code Playgroud)
一切都很好,但表视图滚动不顺畅,因为dataForCellAtIndexPath
方法很慢。所以我需要通过调用此方法来实现将数据惰性填充到单元格中。我期望的结果是表格视图将平滑滚动,但单元格的内容将在绘制单元格后填充一点。请帮助我,该怎么办?
我正在为我的应用程序添加滑动手势识别器
- (void)createGestureRecognizers
{
//adding swipe up gesture
UISwipeGestureRecognizer *swipeUpGesture= [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeUpGesture:)];
[swipeUpGesture setDirection:UISwipeGestureRecognizerDirectionUp];
[self.view addGestureRecognizer:swipeUpGesture];
[swipeUpGesture release];
}
Run Code Online (Sandbox Code Playgroud)
以及处理滑动事件的方法:
-(IBAction)handleSwipeUpGesture:(UISwipeGestureRecognizer *)sender
{
NSLog(@"handleSwipeUpGesture: called");
}
Run Code Online (Sandbox Code Playgroud)
我该如何计算偏移?移动视图?
iphone objective-c uigesturerecognizer ios uiswipegesturerecognizer
我希望我的ios5应用程序发布推文.我正在使用ReyWenderlich教程中的标准代码:
-(void)postOnTwitter:(id)sender
{
NSLog(@"postOnTwitter: called");
if ([TWTweetComposeViewController canSendTweet])
{
TWTweetComposeViewController *tweetSheet =
[[TWTweetComposeViewController alloc] init];
[tweetSheet setInitialText:@"Tweeting from iOS 5 By Tutorials! :)"];
[self presentModalViewController:tweetSheet animated:YES];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"You can't send a tweet right now, make sure your device has an internet connection and you have at least one Twitter account setup" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
};
}
Run Code Online (Sandbox Code Playgroud)
一切都很好,如果我在我的设备上有Twitter帐户,这个代码将工作.但!我需要在我的应用程序的信息屏幕中输入twitter登录名和密码.所以我需要使用我的自定义登录数据执行此操作,而不是通过从twitter帐户中提取的登录数据.对于前者 我需要相同的推文,但登录:123和密码:qwerty.
请帮帮我,怎么办?
我想测试我的应用程序的facebook集成.我的应用程序尚未在appstore中发布.我应该如何处理捆绑ID和appstore ID?我应该在那里写什么数据?如果我在appstore中提供我未发布但已注册的应用程序的bundleID和appstore ID,它会工作吗?
我有一个设置新框架到uiview对象的问题.这是我的代码:
UIImageView *blockImage=[[UIImageView alloc] initWithFrame:CGRectMake(0, [y doubleValue], self.view.frame.size.width, 86)];
[blockImage setImage:[UIImage imageNamed:@"mainscreen_block_sample.jpg"]];
[blockImage setBackgroundColor:[UIColor blackColor]];
//setting anchor point
[blockImage.layer setAnchorPoint:CGPointMake(0.5, 1.0)];
//preparing transform
float distance = 500;
CATransform3D basicTrans = CATransform3DIdentity;
basicTrans.m34 = 1.0 / -distance;
//calculating angle
double OF=oldSize/2.0-difference;
double OC=oldSize/2.0;
double angle= acosf(OF/OC);
angle=angle/2.0;
//transforming
blockImage.layer.transform = CATransform3DRotate(basicTrans, angle, 1.0f, 0.0f, 0.0f);
double newOriginY=[y doubleValue]-difference;
double newFrameHeight=blockImage.frame.size.height;
[blockImage setFrame:CGRectMake(0, newOriginY, blockImage.frame.size.width, newFrameHeight)];
NSLog(@" blockImage frame y: %g", blockImage.frame.origin.y);
NSLog(@" blockImage frame height: %g", blockImage.frame.size.height);
//adding subview
[blocks addObject:blockImage]; …
Run Code Online (Sandbox Code Playgroud) 我有一个视图,如果用户滚动它会更改.我需要一些东西来读取用户的滚动数据(方向,力等)UITableView
.如果用户触摸屏幕并将手指移动到向上视图,则需要接收滚动数据以调用重绘方法.如何接收滚动数据?
我已经开发了原始iPhone,3G和3GS的应用程序,现在我需要为iPhone开发应用程序4.开发iPhone 3GS应用程序和iPhone 4有什么区别?
iphone ×12
objective-c ×12
ios ×7
uitableview ×3
uiview ×3
antialiasing ×1
app-store ×1
avcapture ×1
avfoundation ×1
facebook ×1
frame ×1
ios5 ×1
iphone-3gs ×1
iphone-4 ×1
rotation ×1
twitter ×1
uidevice ×1