设置:
我正在使用Xcode 5中的一个视图来显示一组文本字段.为了在键盘出现时处理滚动,我使用滚动视图来放置我的TextFields.我正在使用autolayout.
问题:
我正在努力解决在运行时将额外空间添加到滚动视图顶部的问题.就像插件被应用到我的滚动视图一样,虽然我已经通过日志记录确认了insets为零.
在我的viewDidLoad()方法实现中我这样做是为了确认值...
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
self.scrollView.contentInset = contentInsets;
self.scrollView.scrollIndicatorInsets = contentInsets;
self.scrollView.contentSize = self.scrollView.bounds.size;
self.scrollView.contentOffset = CGPointMake(0.0, 0.0);
NSLog(@"Content Size: %f x %f", self.scrollView.contentSize.height, self.scrollView.contentSize.width);
NSLog(@"Bounds Size: %f x %f", self.scrollView.bounds.size.height, self.scrollView.bounds.size.width);
NSLog(@"Frame Size: %f x %f", self.scrollView.frame.size.height, self.scrollView.frame.size.width);
NSLog(@"Inset Size top: %f bottom: %f", self.scrollView.contentInset.top, self.scrollView.contentInset.bottom);
NSLog(@"Scroll Inset Size top: %f bottom: %f", self.scrollView.contentInset.top, self.scrollView.contentInset.bottom);
Run Code Online (Sandbox Code Playgroud)
输出:
2013-10-08 11:38:42.953 test[6440:a0b] Content Size: 455.000000 x 320.000000
2013-10-08 11:38:42.954 test[6440:a0b] Bounds Size: 455.000000 …Run Code Online (Sandbox Code Playgroud) 按照Invoicing REST API https://developer.paypal.com/docs/api/#invoicing中提供的一些示例,我始终会收到AUTHORIZATION_ERROR。
这是一个例子:
首先检索我的令牌:
curl https://api.sandbox.paypal.com/v1/oauth2/token \
> -H "Accept: application/json" \
> -H "Accept-Language: en_US" \
> -u "AbNzCxxxxs6iVF0:EBhQWxxxxxxrgefvhb" \
> -d "grant_type=client_credentials"
{"scope":"openid https://uri.paypal.com/services/invoicing https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card","access_token":"F9Ig.4FXq1DQICPrMaUUb0-K--3dWBHvqRck636df4A","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}%
Run Code Online (Sandbox Code Playgroud)
然后使用该令牌创建发票:
curl -v -X 'POST' 'https://api.sandbox.paypal.com/v1/invoicing/invoices' \
> -H 'Content-Type: application/json' \
> -H 'Authorization: Bearer F9Ig.4FXq1DQICPrMaUUb0-K--3dWBHvqRck636df4A' \
> -d '{
quote> "merchant_info": {
quote> "email": "rdg@rapiddg.com",
quote> "first_name": "Mike",
quote> "last_name": "Bopp",
quote> "business_name": "RDG",
quote> "phone": {
quote> "country_code": "001",
quote> "national_number": "5032141716"
quote> },
quote> …Run Code Online (Sandbox Code Playgroud) 我希望我的实体上的必填布尔字段具有默认值TRUE。我已将我的#api-platform属性定义如下。
#[ApiResource(
attributes: ['security' => "is_granted('ROLE_USER')"],
graphql: [
'item_query' => ['security' => "is_granted('ROLE_USER') and object.owner == user"],
'collection_query' => ['security' => "is_granted('ROLE_ADMIN')"],
'delete' => ['security' => "is_granted('ROLE_DEVELOPER')"],
'update' => ['security' => "is_granted('ROLE_DEVELOPER')"],
'create' => [
'defaults' => ['active' => TRUE],
'security' => "is_granted('ROLE_DEVELOPER')"
]
]
)]
Run Code Online (Sandbox Code Playgroud)
活动字段本身注释为
/**
* @ORM\Column(type="boolean", options={"default":true})
*/
private $active;
Run Code Online (Sandbox Code Playgroud)
这确实在数据库模式中设置了默认值,但是 GraphQL 突变似乎仍然要求在请求中提供此属性。当尝试创建一个不指定activeprop 的新实体时,我收到以下错误。
... Field value.active of required type Boolean! was not provided.
Run Code Online (Sandbox Code Playgroud) autolayout ×1
graphql ×1
ios7 ×1
objective-c ×1
paypal ×1
rest ×1
storyboard ×1
uiscrollview ×1