2014-09-23 2 views
30

iOS 8 Today Extension을 만들 때 Interface Builder에서 x = 0의 왼쪽에 레이블을 배치하더라도 왼쪽에 약 48px의 빈 공간이 있습니다. iOS 8의 너비에 맞추기 오늘 연장

on xcode on the simulator



나는 일부 응용 프로그램은, 그러나, 전체 폭 위젯을 사용하는 것이 보았다.

나는 비슷한 달성 할 수있는 방법


other apps

?

감사합니다.


업데이트 : 내가 누군가에게 도움이 될 것입니다 생각하기 때문에 내가 여기에 샘플 코드를 넣어

를 해결했다. @ 마테오를-lallone 제안으로,이 작업을 수행하는 올바른 방법은 다음과 같습니다

워드 프로세서에서 직선
-(UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMa‌​rginInsets{ 
return UIEdgeInsetsZero; 
} 

답변

37

:

Xcode의 오늘 템플릿을 사용하여 만든 오늘 위젯은 표준 자동 레이아웃 제약 조건을 포함 여백 인세 트. 삽입 값 을 계산하려면 widgetMarginInsetsForProposedMarginInsets : 메소드를 구현하십시오.

출처 : App Extension Programming Guide - Today

+5

제안하신대로이 코드를 추가하고 문제가 해결되었습니다. - (UIEdgeInsets) widgetMarginInsetsForProposedMarginInsets : (UIEdgeInsets) defaultMarginInsets {return UIEdgeInsetsZero;} –

+1

링크가 작동하지 않습니다. 이 중 하나를 가져 가십시오 [NotificationCenter.html] (https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/NotificationCenter.html#//apple_ref/doc/uid/TP40014214-CH11-SW5) – Felix

+0

고마워요 @ 펠릭스, 내가 게시했을 때 좋았어! 업데이트 됨. –

23

나는

-(UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets { 
    return UIEdgeInsetsZero 
} 

이 누군가를 도울 수 있기를 바랍니다 OC에 대한 신속한 버전

func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets { 
    return UIEdgeInsetsZero 
} 

를 보완 할 수 있습니다.

+0

정말 고마워. 고마워. – whenov

+0

이것은 나를 위해 해결했습니다. – DeyaEldeen

관련 문제