我刚开始一个新的Sprite Kit项目来学习如何使用它.我观看并阅读了很多教程,但没有教程可以解答我的问题/问题.
我想为我的iPhone 5S创建一个应用程序.因此屏幕尺寸为1136x640.我为我的应用程序创建了一个1136x640背景图像.但是,当我将图像添加到我的应用程序时,它可能会变大!iOS模拟器只显示图像的中间部分.
有人能告诉我我必须使用什么屏幕尺寸以及为什么?
非常感谢!
这是我从教程中复制的代码.代码位于initWithSize方法的myScene.m文件中
SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"myBackground"];
background.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame));
[self addChild:background];
Run Code Online (Sandbox Code Playgroud)
编辑:
我在谷歌搜索并发现了这个:
必须使用"viewWillLayoutSubviews"更改viewDidLoad方法.
这是这个方法:
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
// Configure the view.
SKView * skView = (SKView *)self.view;
skView.showsFPS = YES;
skView.showsNodeCount = YES;
// Create and configure the scene.
SKScene * scene = [MyScene sceneWithSize:CGSizeMake(skView.bounds.size.width*2,skView.bounds.size.height*2)];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
}
Run Code Online (Sandbox Code Playgroud)
起初,scene = MySceneWithSize行是:
SKScene * scene = [MyScene sceneWithSize:skView.bounds.size];
Run Code Online (Sandbox Code Playgroud)
但那时只是iPhone 5屏幕尺寸的一半(568x320).所以我不得不加倍大小.有人知道为什么吗?
首先:我知道有些人已经发布了这样的话题,但没有人在所有这些话题中给出明确答案.
我的应用程序中有一个设置-UITableView.现在我想添加一个TableViewCell,我可以用UIPickerView在一些数字之间进行选择.
在tableView didSelectRowAtIndexPath方法中,我为右侧单元格创建了if语句
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 1){
}
}
Run Code Online (Sandbox Code Playgroud)
如何为此单元格添加UIPickerView?它应该从底部向上滑动,如果有类似"完成"按钮的话会很好.
我正在研究学校项目,需要使用AVR atmega控制器学习C语言的基础知识.
我不明白一切都是如何建立的.例如PORTB,PORTD,DDRB; DDRD,PINB,PIND等等.我不知道if语句,while循环等是如何工作的.
有人可以给我一个简短的解释吗?
我有一些代码行......
DDRB = 0b00000011; // I know that here DDRB is set to input/output
Run Code Online (Sandbox Code Playgroud)
并且if语句:
if (PINB & (1 << PINB0)){
A = true;
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下这个"if语句"是如何工作的吗?为什么PINB & (1<< PINB0))?
谢谢
我的应用程序中有一个表视图,显示了一些项目.当我点击一个项目时,会出现一个新的表格视图(带有导航控制器:推送).因此,在Table视图的顶部,现在有一个带有自动"后退"箭头的导航控制器可以返回.我在右侧启用了"编辑"按钮.
现在我想要当我点击编辑按钮时,后退按钮应该消失,并且应该有一个"+"添加按钮而不是后退按钮.这可能吗?或者可以同时在屏幕上显示"编辑"和"添加"按钮?
谢谢
我有一个改变我的背景颜色的问题UINavigationBar.这是我到目前为止所尝试的:
self.navigationController?.navigationBar.translucent = true
self.navigationController?.navigationBar.backgroundColor = UIColor.blueColor()
Run Code Online (Sandbox Code Playgroud)
导航栏不会更改.即使将半透明度设置为true也完全没有效果.我可以毫无问题地改变色调颜色,但不能改变背景颜色.
但如果我改变故事板中的颜色,它就可以正常工作!
故事板中是否有错误启用/禁用的选项?有人可以帮我弄这个吗?谢谢.
我在android中的布局有问题.我希望两个视图应该具有相同的宽度,并且它们应该几乎使用屏幕的整个宽度.每个视图都应包含一个居中的标签.
它完成时应该看起来像这样:

这是我到目前为止:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<View
android:id="@+id/view1"
android:layout_width="10dp"
android:layout_height="90dp"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp" />
<View
android:id="@+id/view2"
android:layout_width="10dp"
android:layout_height="90dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我现在只有宽度的占位符值.
谢谢.
我正在尝试在数据更改时向用户发送广播通知。但是每次我尝试发送通知时,都会收到此错误:
array_key_exists(): The first argument should be either a string or an integer.
这是我的通知:
class MyNotification extends Notification
{
use Queueable;
public $games;
public $title;
public $summary;
public $url;
public function __construct($games)
{
$this->games = $games;
$this->title = "Your games";
$this->summary = "Games for {$games[0]->team}";
$this->url = "/some/url";
}
public function via($notifiable)
{
return ['mail','broadcast','database'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return …Run Code Online (Sandbox Code Playgroud) broadcast laravel laravel-echo laravel-notification laravel-broadcast
我想UITableView用动画扩展/折叠我的部分.我使用了这个答案,如果我打电话,它现在有效self.tableView.reloadData().但是我希望当我点击我的自定义UITableView标题时,该部分的单元格应该向下/向上滑动一个漂亮的动画.我试图使用self.tableView.beginUpdates()和self.tableView.endUpdates(),但我收到此错误:
Invalid update: invalid number of rows in section 0. The number of rows contained in an
existing section after the update (8) must be equal to the number of rows contained in that
section before the update (0), plus or minus the number of rows inserted or deleted from
that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建类似体育应用程序的东西,其中包含记分牌.我在故事板中创建了一个视图,并在视图中拖动了一些UILabel.然后我将约束添加到标签中.
现在,当我在iPhone上运行应用程序时,屏幕看起来不错.所有字体和标签都有合适的尺寸.但在iPad上看起来像这样:
但它应该是这样的:
如何扩大字体大小和标签,使其在iPad上完美呈现?
谢谢
我正在尝试返回当前iTunes Track的信息,该信息正在我的计算机上播放.
我可以获得这样的单个信息:
tell application "iTunes"
get name of current track
end tell
Run Code Online (Sandbox Code Playgroud)
这返回Thunderstruck例如.
但是有可能我可以获得有关当前曲目的更多信息,因此返回如下内容:
"AC/DC, Thunderstruck, Iron Man 2"
Run Code Online (Sandbox Code Playgroud)
这可能吗?或者我是否必须创建多个脚本?
谢谢
我想检测我的移动精灵(施加脉冲后)是否已停止。是否有类似事件/函数之类的东西可以处理这个问题?
谢谢
我的 IntelliJ 项目有问题。将 VCS 添加到我的项目后,“项目”选项卡中的项目结构不再可见。
这是现在的样子:
其他项目工作正常并且所有内容都可见(例如“src”文件夹、.java 文件...)
有人可以帮忙吗?谢谢
我想从我的 mysql 数据库中获取每天的最高室外温度。它返回我的所有数据,但不返回外部温度。它始终为空。有人能帮我吗?这是mysql代码:
(SELECT MAX(tempOutside), tempInside, pressure, datetime
from weather
WHERE datetime BETWEEN (CURDATE() - INTERVAL 30 DAY) AND CURDATE()
GROUP BY MONTH(datetime), DAY(datetime));
Run Code Online (Sandbox Code Playgroud)
现在返回:
null 18.4 1011 2014-01-23 00:15:04
null 19.2 1010 2014-01-24 00:00:05
null 19.6 1009 2014-01-25 13:15:02
Run Code Online (Sandbox Code Playgroud)
我的错误在哪里?一个解释会很好。谢谢
编辑:
我发现了错误。在我的 PHP 文件中我写了$row_array['tempOutside'] = ...在我更改 mysql 代码后MAX(tempOutside) AS tempOutside, ...它起作用了!
但我现在有一个新问题。它现在返回 maxOutSide 温度,但内部压力值和时间戳不是记录最大外部温度时记录的值。我该如何解决这个问题?应该是这样的:最大室外温度是在下午 5 点记录的 - 当时的内部和压力值是:...
ios ×7
iphone ×5
uitableview ×3
objective-c ×2
sprite-kit ×2
swift ×2
android ×1
animation ×1
applescript ×1
atmega ×1
avr ×1
broadcast ×1
c ×1
ipad ×1
itunes ×1
java ×1
laravel ×1
laravel-echo ×1
macos ×1
max ×1
mysql ×1
php ×1
scale ×1
sql ×1
uifont ×1
uipickerview ×1
view ×1