所以我有以下代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = @"FriendsCell";
FriendData * fd = [self.friendsDataSource_ objectAtIndex:indexPath.row];
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
[cell.imageView setImageWithURL:[NSURL URLWithString:fd.imageUrl_]];
[cell.imageView setFrame:CGRectMake(0, 0, 30, 30)];
[cell.textLabel setText:fd.name_];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
但是,我没有在单元格中看到imageView.我究竟做错了什么?
我使用UITableView和静态单元格.如果我使用reloadData,比一切都好.
如果我尝试reloadRowsAtIndexPaths它隐藏行.如果我向上拖动tableView(当单元格更新时),则会出现行.
我试了这个没有运气:
NSData *imageData = UIImageJPEGRepresentation([sight.photo valueForKey:@"image"], 0.8);
NSString *docsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [docsPath stringByAppendingPathComponent:@"sound.m4a"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
NSData *aacData = [sight.sound valueForKey:@"soundrecord"];
[aacData writeToURL:fileUrl atomically:YES];
// NSString *text = self.textField.text;
NSArray *items = @[imageData, aacData];
Run Code Online (Sandbox Code Playgroud) 我使用Facebook SDK和FBLoginView登录Facebook,我得到了一个基本的用户信息,但我需要更多的权限,如email,birthday.如何添加权限?
Apple拒绝了我的应用,因为:
3.3.1应用程序只能以Apple规定的方式使用Documented API,不得使用或调用任何私有API.应用程序必须最初使用Objective-C,C,C++或JavaScript编写,由iPhone OS WebKit引擎执行,并且只有使用C,C++和Objective-C编写的代码可以编译并直接链接到Documented API(例如,禁止通过中间翻译或兼容性层或工具链接到Documented API的应用程序.
您的应用程序中包含的非公共API是animationDidStop:finished:context:.
这是我使用上述方法调用的方法:
- (void)hideMsg
{
// Slide the view off screen
CGRect frame = self.view.frame;
int retractY;
int retractX;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.75];
retractY = -190;
retractX = 0;
frame.origin.y = retractY;
frame.origin.x = retractX;
self.view.frame = frame;
//to autorelease the Msg, define stop selector
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView commitAnimations];
}
Run Code Online (Sandbox Code Playgroud)
我正在使用此方法在某个事件发生后显示滑动消息.
但我没有定义这种方法.当我试图找到它时,只能在CAAnimation.h,UIView.h中找到它.
有没有人遇到同样的问题?你怎么修好它的?
所以我有一个应用程序,当前可以使用前置iphone摄像头捕获视频,然后实时处理视频源.但是,我要做的是让这个过程在后台运行并将其他控件放在屏幕上.例如,假设我想运行相机并处理图像输入,但我希望用户看到黑屏,上面有一些按钮.关于如何做到这一点的任何想法?
保存时出现以下错误managedObjectContext:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[Image count]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
码:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo {
// Delete any existing image.
Image *oldImage = _place.image;
if (oldImage != nil) {
[_place.managedObjectContext deleteObject:oldImage];
}
Image *image = [NSEntityDescription insertNewObjectForEntityForName:@"Image" inManagedObjectContext:_place.managedObjectContext];
image.imageData = UIImageJPEGRepresentation(selectedImage, 0.5);
_place.image = image;
[_place.managedObjectContext save:nil]; //Here is the crash
[self dismissViewControllerAnimated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
Image实体有两个一对一的关系:place和trip.
@interface Image : NSManagedObject
@property (nonatomic, retain) NSData …Run Code Online (Sandbox Code Playgroud) 我喜欢Realm,我喜欢邦德.它们都使应用程序创建成为一种乐趣.所以我想知道连接Realm和Bond的最佳方式是什么?
在领域,我们可以存储基本类型,比如Int,String例如但在债券与我们合作的DynamicS和Bond秒.我发现连接Realm和Bond的唯一方法是:
class TestObject: RLMObject {
dynamic var rlmTitle: String = ""
dynamic var rlmSubtitle: String = ""
var title: Dynamic<String>
var subtitle: Dynamic<String>
private let titleBond: Bond<String>!
private let subtitleBond: Bond<String>!
init(title: String, subtitle: String) {
self.title = Dynamic<String>(title)
self.subtitle = Dynamic<String>(subtitle)
super.init()
self.titleBond = Bond<String>() { [unowned self] title in self.rlmTitle = title }
self.subtitleBond = Bond<String>() { [unowned self] subtitle in self.rlmSubtitle = subtitle } …Run Code Online (Sandbox Code Playgroud) 我有tmpPixelBuffer像素缓冲区数据的临时变量nil,但是,当检测到元数据对象时,我想从该缓冲区创建图像,因此我可以从该图像中裁剪元数据图像.
图像总是nil,我做错了什么?
func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) {
tmpPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)
}
func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) {
let image = CIImage(CVPixelBuffer: tmpPixelBuffer)
let context = CIContext()
let cgiImage = context.createCGImage(image, fromRect: image.extent())
let capturedImage = UIImage(CGImage: cgiImage)
...
}
Run Code Online (Sandbox Code Playgroud)
我也尝试这样做:
func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) {
let image = CIImage(CVPixelBuffer: tmpPixelBuffer)
let context = CIContext(options: nil)
let cgiImage = context.createCGImage(image, fromRect: …Run Code Online (Sandbox Code Playgroud) 试图创建一个视图UITextField,并UILabel超越它.以下代码有什么问题?
- (UIView *)tableHeaderView{
NSArray *constraints;
UIView *view = [[UIView alloc]initWithFrame:(CGRect){0,0,self.view.frame.size.width, 88}];
UITextField *tf = [[UITextField alloc]init];
tf.borderStyle = UITextBorderStyleRoundedRect;
tf.text = _filter.name;
[view addSubview:tf];
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Found results: %d", nil), _filter.resultsCount];
[view addSubview:titleLabel];
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-[titleLabel]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(titleLabel)];
[view addConstraints:constraints];
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-[tf]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(tf)];
[view addConstraints:constraints];
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[titleLabel]-8-[tf]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(titleLabel, tf)];
[view addConstraints:constraints];
} …Run Code Online (Sandbox Code Playgroud) ios ×7
objective-c ×7
iphone ×3
ios6 ×2
swift ×2
afnetworking ×1
architecture ×1
camera ×1
core-data ×1
core-image ×1
facebook ×1
ios5 ×1
ios7 ×1
ipad ×1
nsautolayout ×1
realm ×1
swiftbond ×1
uitableview ×1
video ×1