普通按钮不能设置为小于109像素,RadioButtons不能小于168像素.
这些限制仅允许水平并排放置3个按钮或2个单选按钮.
有没有办法让按钮变小?
我在AppStore中可用的两个程序在iOS3和iOS4上运行没有任何问题与iOS5不兼容.
在我看来,Apple已经改变了一些东西,使开发人员的生活变得更加困难.
其中一个问题是:
- (BOOL) webView: (UIWebView *) webView shouldStartLoadWithRequest:(NSURLRequest *) request navigationType: (UIWebViewNavigationType) navigationType {
// Only do something if a link has been clicked
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSString *link = [[request URL] absoluteString];
if ([link hasPrefix:@"playSound:"]) {
[PlayAudio playAudio: [link substringFromIndex:10]];
return NO;
}
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
产生问题的那条线是
NSString *link = [[request URL] absoluteString];
Run Code Online (Sandbox Code Playgroud)
在我得到未经修改的点击链接副本之前.在iOS3和iOS4中它仍然是相同的.但在iOS5上它只转换为小写.下一行
if ([link hasPrefix:@"playSound:"]) {
Run Code Online (Sandbox Code Playgroud)
永远不会成真.所以我不得不将代码更改为
- (BOOL) webView: (UIWebView *) webView shouldStartLoadWithRequest:(NSURLRequest *) request navigationType: (UIWebViewNavigationType) navigationType {
// Only …
Run Code Online (Sandbox Code Playgroud) 我想将mapping.txt上传到Google Playstore以获取去混淆的崩溃报告.在上传新的APK时,没有人要求这样做.如何上传映射文本?
我的应用程序设计用于纵向和横向。从 iOS 8 开始,如果设备横向握持,则启动应用程序时会出现问题。用户界面根本没有正确初始化。
我的用户必须关闭应用程序并在纵向握住设备的同时重新启动。
如何安排应用程序始终以纵向模式启动而不将其锁定到此模式?在此之后,应允许用户更改所有四个方向。
在我的视图控制器中,shouldAutorotate 返回 true,而 supportedInterfaceOrientations 返回所有。
在我的适用于Windows 8.1(存储)和Windows Phone 8.1的通用应用程序中,仅在Store App中打开数据库时有例外.这两个代码共享,对于Windows Phone,它正在运行.
class MemoDB
{
public static SQLiteConnection conn;
public MemoDB() {
conn = LoadDatabase();
}
static private SQLiteConnection LoadDatabase()
{
// Get a reference to the SQLite database
conn = new SQLiteConnection("ct_history.sqlite");
...
}
}
Run Code Online (Sandbox Code Playgroud)
异常{"无法设置临时目录."}出现在最后显示的代码行中,详细信息如下:
SQLitePCL.SQLiteException was not handled by user code.
HResult=-2146233088
Message=Unable to set temporary directory.
Source=SQLitePCL
StackTrace:
at SQLitePCL.SQLiteConnection.SetTemporaryDirectory()
at SQLitePCL.SQLiteConnection..ctor(String fileName, Boolean setTemporaryDirectory)
at SQLitePCL.SQLiteConnection..ctor(String fileName)
at CTDICT.MemoDB.LoadDatabase()
at CTDICT.MemoDB..ctor()
at CTDICT.Dictionary..ctor()
at CTDICT.CTDICT_Windows_XamlTypeInfo.XamlTypeInfoProvider.Activate_8_Dictionary()
at CTDICT.CTDICT_Windows_XamlTypeInfo.XamlUserType.ActivateInstance()
InnerException: SQLitePCL.SQLiteException
HResult=-2146233088
Message=Unable …
Run Code Online (Sandbox Code Playgroud) 在XAML中,可以很容易地定义带有图像的按钮:
<Button x:Name="btnSound"
Click="SoundButton"
Height="40"
HorizontalAlignment="Left"
VerticalAlignment="Bottom" Margin="20,0">
<Image x:Name="speakerImg" Source="/png/btn_speak_i.png" />
</Button>
Run Code Online (Sandbox Code Playgroud)
我想这样做c#
:
// Prepare two BitmapImages
BitmapImage SoundDisable = new BitmapImage(new Uri("ms-appx:///png/btn_speak_i.png",
UriKind.RelativeOrAbsolute));
BitmapImage SoundEnable = new BitmapImage(new Uri("ms-appx:///png/btn_speak.png",
UriKind.RelativeOrAbsolute));
// Define and Load Button
btnSound = new Button();
btnSound.HorizontalAlignment = HorizontalAlignment.Left;
btnSound.VerticalAlignment = VerticalAlignment.Bottom;
Thickness margin = new Thickness(0,00,20,0);
btnSound.Margin = margin;
btnSound.Click += new RoutedEventHandler(btnSound_Click);
btnSound.IsEnabled = false;
topBar.Children.Add(btnSound);
Run Code Online (Sandbox Code Playgroud)
我找不到将图像添加到按钮的方法.就像是
btnSound.Content = SoundDisable;
Run Code Online (Sandbox Code Playgroud)
不管用.它仅显示带有按钮内图像类型的文本.在XAML版本中,我设置了图像
speakerImg.Source = SoundDisable;
Run Code Online (Sandbox Code Playgroud)
因为图像是用一个定义的x:Name
.
如何以编程方式将命名图像添加到我的按钮?