我试图学习UIPageViewControllers并找到一个我无法解决的问题.这就是我试图做的事情:
PageViewController表现为一个dataSource和delegate自己.有没有人经历过这个?
@interface AMPageViewController : UIPageViewController <UIPageViewControllerDataSource, UIPageViewControllerDelegate>
@end
Run Code Online (Sandbox Code Playgroud)
实施:
#import "AMPageViewController.h"
@interface AMPageViewController ()
{
UIViewController *mainController;
UIViewController* socController;
}
@end
@implementation AMPageViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
bundle: nil];
mainController = (UIViewController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"First"];
socController = (UIViewController*)[mainStoryboard …Run Code Online (Sandbox Code Playgroud) objective-c uitextview uiviewcontroller uipageviewcontroller ios6
我想在两个SKPhysicsBodies之间创建简单的关节.但是,他们表现得非常奇怪.我很清楚锚点应该在场景坐标上.请查看附带的源代码.
例如,这是在矩形上附加小方块后如何生成固定关节.
-(void)createFixedJointOnScene:(SKScene*)scene
Run Code Online (Sandbox Code Playgroud)
{
//Adding Rectangle
SKSpriteNode* backBone = [[SKSpriteNode alloc] initWithColor:[UIColor whiteColor] size:CGSizeMake(20, 200)];
backBone.position = CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetHeight(self.frame)/2.0);
backBone.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:backBone.size];
backBone.physicsBody.categoryBitMask = GFPhysicsCategoryRectangle;
backBone.physicsBody.collisionBitMask = GFPhysicsCategoryWorld;
[scene addChild:backBone];
//Adding Square
SKSpriteNode* head = [[SKSpriteNode alloc] initWithColor:[SKColor grayColor] size:CGSizeMake(40, 40)];
head.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:head.size];
head.position = CGPointMake(backBone.position.x, backBone.position.y-40);
head.physicsBody.categoryBitMask = GFPhysicsCategorySquare;
head.physicsBody.collisionBitMask = GFPhysicsCategoryWorld;
[scene addChild:head];
//Pinning Rectangle and Square
NSLog(@"Head position %@", NSStringFromCGPoint(head.position));
SKPhysicsJointFixed* pin =[SKPhysicsJointFixed jointWithBodyA:backBone.physicsBody bodyB:head.physicsBody anchor:head.position];
[self.physicsWorld addJoint:pin];
Run Code Online (Sandbox Code Playgroud)
}

https://dl.dropboxusercontent.com/u/62559842/PhysicsTest.zip
谢谢.
我试图从UNKNOWN格式的NSString中获取NSDate ,所以我写了一个类似下面的函数
-(void)dateFromString:(NSString*)string {
NSError *error = NULL;
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:(NSTextCheckingTypes)NSTextCheckingTypeDate error:&error];
NSArray *matches = [detector matchesInString:string
options:0
range:NSMakeRange(0, [string length])];
NSLocale* currentLoc = [NSLocale currentLocale];
for (NSTextCheckingResult *match in matches) {
if ([match resultType] == NSTextCheckingTypeDate) {
NSLog(@"Date : %@", [[match date] descriptionWithLocale:currentLoc]);
}
}
}
Run Code Online (Sandbox Code Playgroud)
除了一个地方外,它运作良好.
如果我调用
[self dateFromString:@"6/12"];
Run Code Online (Sandbox Code Playgroud)
它打印
日期:2014年6月12日,星期四,澳大利亚东部标准时间下午12:00:00
如果我打电话的话
[self dateFromString:@"13/12"];
Run Code Online (Sandbox Code Playgroud)
它打印
日期:2013年12月13日星期五下午12:00:00澳大利亚东部夏令时间
基本上,我希望函数表现一致.由于我住在澳大利亚,它应该在12月6日返回首次执行.第二次通话结果是正确的.
我在这做错了什么?
如何将UIRefreshControl添加到UIColloectionView的底部?这意味着当涉及到Scroll up(查看旧数据或其他内容)时它是如何工作的?
我从来没有使用过NSScrollView,但是看一下教程,我觉得应该很容易理解.
然而,事实证明它根本不直观.我拉了一个ScrollView.虽然我已启用,但它没有任何滚动条.没有地方可以设置ContentArea或某种类型.和.它里面有一个剪辑视图,剪辑视图里面有另一个视图.您只能在第三个视图中添加视图.
所以我想在里面添加一个Image视图,它根本不起作用.当我跑步时,它没有显示出来.没有.
我究竟做错了什么?
这是项目的DropBox链接
objective-c ×4
ios ×2
ios6 ×1
ios7 ×1
macos ×1
nsdate ×1
nsscrollview ×1
physics ×1
sprite-kit ×1
storyboard ×1
uitextview ×1
xcode ×1