電話のプログラミングは初めてです.1つのビューからストーリーボードの最初のビューに移動する方法を教えてください.以下のコードはfirstviewcontroller.mクラスです.ストロイボードの最初のビューを最初に表示する firstviewcontroller。
#import"firstviewcontroller.h"
-(IBAction)show:(id)sender
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
LXCollectionViewController *Controller = [storyboard instantiateViewControllerWithIdentifier:@"Controller "];
[self presentModalViewController:loginController animated:YES];
}
以下のコードはストーリーボードの firstview コードです。この xib ビューからストーリーボード ビューに移動するにはどうすればよいですか。
#import "LXCollectionViewController.h"
#import "PlayingCard.h"
#import "PlayingCardCell.h"
@implementation LXCollectionViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)awakeFromNib {
[super awakeFromNib];
self.deck = [self constructsDeck];
}
- (NSMutableArray *)constructsDeck {
NSMutableArray *theDeck = [NSMutableArray arrayWithCapacity:52];
for (NSInteger theRank = 1; theRank <= 13; theRank++) {
// Spade
{
PlayingCard *thePlayingCard = [[PlayingCard alloc] init];
thePlayingCard.suit = PlayingCardSuitSpade;
thePlayingCard.rank = theRank;
[theDeck addObject:thePlayingCard];
}
}
return theDeck;
}
- (void)viewDidLoad {
// NSLog(@"%@",theDeck);
[super viewDidLoad];
// Do any additional setup after loading the view.
}
#pragma mark - UICollectionViewDataSource methods
- (NSInteger)collectionView:(UICollectionView *)theCollectionView numberOfItemsInSection:(NSInteger)theSectionIndex {
switch (theSectionIndex) {
case 0: {
return [[self valueForKeyPath:@"deck.@count"] integerValue];
} break;
default: {
return 0;
} break;
}
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)theCollectionView cellForItemAtIndexPath:(NSIndexPath *)theIndexPath {
NSInteger theSectionIndex = theIndexPath.section;
NSInteger theItemIndex = theIndexPath.item;
switch (theSectionIndex) {
case 0: {
PlayingCard *thePlayingCard = [self.deck objectAtIndex:theItemIndex];
PlayingCardCell *thePlayingCardCell = [theCollectionView dequeueReusableCellWithReuseIdentifier:@"PlayingCardCell" forIndexPath:theIndexPath];
thePlayingCardCell.playingCard = thePlayingCard;
return thePlayingCardCell;
} break;
default: {
return nil;
} break;
}
}
#pragma mark - LXReorderableCollectionViewDelegateFlowLayout methods
- (void)collectionView:(UICollectionView *)theCollectionView layout:(UICollectionViewLayout *)theLayout itemAtIndexPath:(NSIndexPath *)theFromIndexPath willMoveToIndexPath:(NSIndexPath *)theToIndexPath {
id theFromItem = [self.deck objectAtIndex:theFromIndexPath.item];
[self.deck removeObjectAtIndex:theFromIndexPath.item];
[self.deck insertObject:theFromItem atIndex:theToIndexPath.item];
}
上記の IBAction のコードがうまくいきません。フォーム xib をストーリーボードの firstview に接続する方法を教えてください。