小编mad*_*ulf的帖子

CSS 在打印时指定全页宽度?

由于打印特定样式,我有一个 html 页面打印得很好,除了一件事:它不使用页面的全宽。换句话说,我希望页面被缩放以填充页面。

是否可以使用 css 样式获得该结果?

html css printing

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

在iOS中未调用ABAddressBook外部回调

我有一个班级,在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)

objective-c abaddressbook ios

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

Objective-c,迭代空NSArray时的奇怪行为

我不明白这段代码发生了什么:

sortedArray是NSMutableArray,为空,因此,sortedArray.count的值为0.

     for (NSUInteger i = 0 ; i < (sortedArray.count -1) ; i++) 
         NSLog(@"Apparently %d < %d  ( [sortedArray count] %d)", i, sortedArray.count-1, [sortedArray count] );
Run Code Online (Sandbox Code Playgroud)

因此,我们永远不应该进入循环,但我在日志中看到以下内容:

2014-01-21 12:11:16.433 AppName [445:60b]显然0 <-1([sortedArray count] 0)

有没有人知道什么可以触发问题?

objective-c nsmutablearray nsarray

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

使用UIDocumentInteractionController时,请点击"在Instagram中打开"

我有以下课程:

.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]中.

objective-c ios instagram

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