2013-06-05 86 views
0

我有問題,所以我創建了一個簡單的小應用程序,只需要保存到一個視圖,又上有一個UITextView滾動型。下面的代碼是我設置它的所有代碼。如果放大文字模糊。我已經看到有關此的其他帖子,並且建議已經在UITextView上設置contentScaleFactor。但是,這也不起作用。另一個建議是確保UITextField的框架不在像素之間......在我的示例中,您可以看到框架位於整個像素上。在一個UIScrollView一個模糊的UITextView模糊的UITextView中的UIScrollView

所以我在爲如何設法使文字呈現清晰的思路損失。

如果任何人有任何想法,請讓我知道。

感謝,

彼得

@implementation SIAppDelegate 
{ 
    UITextView *textView; 
    float originalFontSize; 
} 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions 
{ 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    // Override point for customization after application launch. 
    self.viewController = [[SIViewController alloc] initWithNibName:@"SIViewController" bundle:nil]; 
    self.window.rootViewController = self.viewController; 

    //Setting up the scroll view 
    UIScrollView *scrollView = (UIScrollView *)self.viewController.view; 
    scrollView.delegate = self; 

    scrollView.maximumZoomScale = 5; 
    scrollView.minimumZoomScale = 1; 

    //Setting up the content view 
    UIView *view = [[UIView alloc] initWithFrame:scrollView.frame];  
    view.backgroundColor = [UIColor blueColor]; 

    textView = [[UITextView alloc] initWithFrame:CGRectIntegral(CGRectMake(200, 200, 200, 200))]; 
    textView.text = @"Hello, World"; 

    [view addSubview:textView]; 
    [scrollView addSubview:view]; 

    scrollView.contentSize = CGSizeMake(2000, 2000); 


    [self.window makeKeyAndVisible]; 
    return YES; 
} 



-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView 
{ 
    return scrollView.subviews[0]; 
} 

-(void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale 
{ 
[scrollView.subviews[0] setContentScaleFactor:scale]; 

textView.contentScaleFactor = scale; 


} 

@end 
+0

記錄每一幀 - NSStringFromCGRect() - 賭注東西是不完整的 –

回答

0

試着看一下這篇文章: Stackoverflow

貌似比例因子是正確的道路要走,但只使用默認比例從scrollview委託不足以獲得清晰的文本。

相關問題