由于打印特定样式,我有一个 html 页面打印得很好,除了一件事:它不使用页面的全宽。换句话说,我希望页面被缩放以填充页面。
是否可以使用 css 样式获得该结果?
我有一个班级,在iPhone应用程序中保存我的用户的联系人列表.
其核心实现如下.
//file Contacts.m
//imports here
void MyAddressBookExternalChangeCallback (
ABAddressBookRef addressBook,
CFDictionaryRef info,
void *context
)
{
NSLog(@"callback called ");
[[Contacts sharedInstance] refresh];
}
@implementation Contacts
@synthesize addressBook;
+ (Contacts*)sharedInstance
{
@synchronized(self)
{
if (sharedInstance == nil)
{
sharedInstance = [[Contacts alloc] init];
}
}
return sharedInstance;
}
- (void)refresh
{
ABAddressBookRevert(addressBook); /*refreshing the address book in case of changes*/
[people release];
people = (NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
}
- (id)init
{
if ((self = [super init]))
{
sharedInstance = self;
addressBook = …Run Code Online (Sandbox Code Playgroud) 我不明白这段代码发生了什么:
sortedArray是NSMutableArray,为空,因此,sortedArray.count的值为0.
Run Code Online (Sandbox Code Playgroud)for (NSUInteger i = 0 ; i < (sortedArray.count -1) ; i++) NSLog(@"Apparently %d < %d ( [sortedArray count] %d)", i, sortedArray.count-1, [sortedArray count] );
因此,我们永远不应该进入循环,但我在日志中看到以下内容:
2014-01-21 12:11:16.433 AppName [445:60b]显然0 <-1([sortedArray count] 0)
有没有人知道什么可以触发问题?
我有以下课程:
.h文件:
#import <Foundation/Foundation.h>
@interface CHTInstagramSharer : NSObject<UIDocumentInteractionControllerDelegate>
@property (nonatomic, retain) UIDocumentInteractionController *dic;
-(void) sharePic:(UIImage *)image;
@end
Run Code Online (Sandbox Code Playgroud)
.m文件
#import "CHTInstagramSharer.h"
#import <UIKit/UIKit.h>
#import "BaseController.h"
@implementation CHTInstagramSharer
-(void) sharePic:(UIImage *)image{
NSString * jpgPath = [Utils saveImage:image toFile:@"cover.igo"];
NSURL *url = [NSURL fileURLWithPath:jpgPath];
self.dic = [UIDocumentInteractionController interactionControllerWithURL: url];
self.dic.UTI = @"com.instagram.exclusivegram";
self.dic.delegate = self;
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Caption Test" forKey:@"InstagramCaption"];
[self.dic presentOpenInMenuFromRect:CGRectMake(0, 0, 320, 44) inView:[BaseController sharedInstance].view animated: YES ];
}
@end
Run Code Online (Sandbox Code Playgroud)
它为控制器提供了"在Instagram中打开"选项,但是当我点击它时,应用程序崩溃了.
知道为什么吗?
补充信息,当我查看调试器中的url时,我得到:file://localhost/var/mobile/Applications/53435781-3BAB-4B02-A80C-FC088F696AE8/Library/Caches/cover.igo
当我查看堆栈跟踪时,崩溃似乎发生在[_UIOpenWithAppActivity performActivity]中.