cwRichardKim/TinderSimpleSwipeCards
을 사용합니다. 내 First view controller
에서 제대로 작동합니다. 이제 다른 JSON
어레이가있는 다른 View Controller에서이 기능을 사용하고 싶습니다. 이것을 어떻게 할 수 있습니까?두 개의 서로 다른 뷰 컨트롤러와 배열을위한 프레임 워크를 사용하여
CGRect frame = self.invitationViewContainer.frame;
//frame.origin.y = -self.view.frame.size.height; //optional: if you want the view to drop down
DraggableViewBackground *draggableBackground = [[DraggableViewBackground alloc]initWithFrame:frame];
draggableBackground.alpha = 0; //optional: if you want the view to fade in
[draggableBackground loadCards:_arrAllCards];
[self.invitationViewContainer addSubview:draggableBackground];
및 DraggableViewBackground ViewClass
에 : 다른 JSON 배열에 대한
-(void)loadCards:(NSArray*)array
{
exampleCardLabels = array;
if([exampleCardLabels count] > 0) {
NSInteger numLoadedCardsCap =(([exampleCardLabels count] > MAX_BUFFER_SIZE)?MAX_BUFFER_SIZE:[exampleCardLabels count]);
//%%% if the buffer size is greater than the data size, there will be an array error, so this makes sure that doesn't happen
//%%% loops through the exampleCardsLabels array to create a card for each label. This should be customized by removing "exampleCardLabels" with your own array of data
for (int i = 0; i<[exampleCardLabels count]; i++) {
DraggableView* newCard = [self createDraggableViewWithDataAtIndex:i];
[allCards addObject:newCard];
if (i<numLoadedCardsCap) {
//%%% adds a small number of cards to be loaded
[loadedCards addObject:newCard];
}
}
내가 같은 클래스를 사용하거나 내가 다른 클래스를 확인해야 이것은 내가 내 first ViewController
에 어떻게 무엇입니까?
질문을 제대로받지 못했습니다! – Lion
예,이 클래스를 다른 JSON 배열과 함께 사용할 수 있습니다. –
어떻게 그때 사용할 수 있습니다 ... @ SaurabhJain –