내 응용 프로그램에서 UICOllectionView를 사용했지만 IOS 6.0에서 작동했지만 IOS7에서 실행하려고하면 콜렉션보기가 표시되지 않습니다. i saw this question 나는 주어진 답변을 시도했지만 그만했습니다. dint work, 그리고 나서 콜렉션 뷰의 moveItemAtIndexPath 메소드를 사용하고 셀을 앞뒤로 바꾼 다음 셀이 표시되지만 셀을 아래로 스크롤하면 사라집니다. 내가 사용하는 코드는 hereiOS 7에서 UI 컬렉션보기가 표시되지 않음
답변
코드를 공부합니다. & 변경합니다.
이 코드를 사용해보십시오. Code
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init];
_collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake(130, 100, 780, 1024) collectionViewLayout:layout];
_collectionView.autoresizesSubviews= YES;
[_collectionView setDataSource:self];
[_collectionView setDelegate:self];
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
[self.view addSubview:_collectionView];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 12;
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
UIView *headertitle = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 375, 20)];
UILabel *titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 20)];
titlelabel.text = [NSString stringWithFormat:@"graphtitle%d",indexPath.row];
titlelabel.textColor = [UIColor blackColor];
titlelabel.font = [UIFont fontWithName:@"Knewave" size:15.0f];
titlelabel.backgroundColor = [UIColor clearColor];
[headertitle addSubview:titlelabel];
headertitle.backgroundColor = [UIColor whiteColor];
UIWebView *web = [[ UIWebView alloc]initWithFrame:CGRectMake(0, 20, 375, 150)];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
web.scalesPageToFit = YES;
[web loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
button1.backgroundColor = [UIColor clearColor];
button1.frame = CGRectMake(320, 3, 50, 17);
[button1 setTitle:@"view" forState:UIControlStateNormal];
[headertitle addSubview:button1];
headertitle.backgroundColor = [UIColor grayColor];
[cell addSubview:headertitle];
[cell addSubview:web];
cell.layer.shadowColor = [[UIColor blackColor]CGColor];
cell.layer.shadowOffset = CGSizeMake(20, 20);
cell.layer.borderColor = [[UIColor blackColor] CGColor];
cell.layer.borderWidth =1;
//cell.alpha = 1.0f; //Changed here
return cell;
}
당신은 내가 스토리 보드하지만 같은 문제를 사용하여 시도
이 정보가 도움이 되었습니까? – user1673099
http://stackoverflow.com/help/how-to-answer를 보시기 바랍니다 : 외부 리소스에 대한 링크가 권장됩니다.하지만 링크 주위에 컨텍스트를 추가하여 동료 사용자가 그것이 무엇이며 왜 그것이 무엇인지 알 수 있도록하십시오. 그곳에. 대상 사이트에 도달 할 수 없거나 영구적으로 오프라인 상태가되는 경우 중요한 링크의 가장 중요한 부분을 항상 인용하십시오. –
@ MartinR 귀하의 설명에 감사드립니다. 그래서, 여기에 전체 코드를 쓸 수 있습니까? – user1673099
- 1. iOS - 툴바가 표시되지 않음
- 2. iOS - 키보드가 표시되지 않음
- 3. iOS 가로 컬렉션보기가 완전히 스크롤되지 않습니다.
- 4. iOS 7에서 완전히 사용자 지정된 UI
- 5. jQuery UI 슬라이더가 표시되지 않음
- 6. iOS 시뮬레이터 렌더링하지 않음 UI
- 7. iOS 앱에서 SMS보기가 표시되지 않음
- 8. iOS UICollectionView : 셀이 표시되지 않음
- 9. UOSutton이 iOS 9.3에 표시되지 않음
- 10. UIInputViewController 키보드가 iOS 8에 표시되지 않음
- 11. 컬렉션보기가 스크롤되지 않습니까?
- 12. 상용구 컬렉션보기가 업데이트되지 않습니다?
- 13. 각도 UI 라우터에 오류나 내용이 표시되지 않음
- 14. jQuery UI 자동 완성 카테고리가 표시되지 않음
- 15. 스토리 보드 UI 요소가 편집기에 표시되지 않음
- 16. 모달보기 컨트롤러는 iOS 7에서 작동하며 iOS 6에는 간격을 남깁니다.
- 17. iOS MapKit 주석, 정확한 위치가 표시되지 않음
- 18. IOS 7 테이블 셀이 표시되지 않음
- 19. iOS 5.0 시뮬레이터 : GKLeaderBoardViewController가 표시되지 않음
- 20. iOS 인앱 구매 : 확인 경고가 표시되지 않음
- 21. iOS 국제화 스토리 보드가 표시되지 않음
- 22. iOS 빌드가 iTunes Connect 어디에도 표시되지 않음
- 23. iOS : TabController가 내비게이션 컨트롤러와 함께 표시되지 않음
- 24. Studio에서 iOS 10 기기의 로그가 표시되지 않음
- 25. Xamarin 양식 페이지가 표시되지 않음 (iOS)
- 26. Xcode 6에 iOS 7.1 시뮬레이터가 표시되지 않음
- 27. iOS 앱 빌드가 iTunes Connect에 표시되지 않음
- 28. 7.1 이하의 iOS 버전에 UITextView가 표시되지 않음
- 29. 게임 센터 인증보기가 표시되지 않음 - iOS
- 30. iOS 6지도가 표시되지 않음 lat long location
온 어떤 문제가 있다면 알려주세요 ... – BalaChandra
당신이 관련 부품을 포함하도록 질문을 수정시겠습니까 당신의 암호? 링크 된 자원은 6 일 후에 만료되고 귀하의 질문은 아직 덜 미래의 방문자를 위해 이해할 수있게됩니다. –
@AlexanderKosubek 나는 연결된 자원을 변경했습니다. – BalaChandra