是否有可能以某种方式锁定字段,MFMailComposeViewController以便用户无法更改正文,收件人等?我需要用户发送的电子邮件去特定帐户和身体符合某些标准,所以如果用户大幅度编辑格式,一切都可能会出现可怕的错误.当时正文从用户的数据填充输入到上一个视图中的文本字段和日期选择器.
基本上我认为将字段锁定而不是显示警告或者说"请不要编辑消息"这样更专业,所以如果字段无法锁定,这不是一个大问题,但任何帮助我将不胜感激.
我有一个for循环,目前循环4次.
//Add all the URLs from the server to the array
for (int i = 1; i <= 5; i++){
NSString *tempString = [[NSString alloc] initWithFormat : @"http://photostiubhart.comoj.com/GalleryImages/%dstiubhart1.jpg", i];
[myURLS addObject: [NSURL URLWithString:tempString]];
[tempString release];
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,URL中有一个数字,每个循环增加1,以创建下一个图像所在的新URL.但是,服务器上的图像数量不一定是4,可能更多甚至更少.我的问题是,有没有办法可以检查URL中是否存有图像?如果没有,打破循环并继续执行程序?
谢谢,
插口
我有一个需要显示一系列图表的应用程序(使用Core Plot).我希望这些图中的每一个都优选地使用分页控制器在其自己的视图中显示.我有8张图.
有人可以指导我一个资源,展示如何在iOS 5中使用故事板实现类似的功能吗?我似乎无法找到任何用故事板解释这一点的东西..
谢谢,
插口
我有一个plist文件,这是一个字典数组.每个字典包含一组字符串.每个字典代表一个名人.
我想要做的是在应用程序首次启动时使用此plist的内容填充Core Data,之后我想以某种方式检查核心数据是否存在我的数据,如果有数据,则从那里加载,否则再次从plist文件加载初始数据.
我知道可以从plist中填充核心数据,但是我建议一个可行的解决方案吗?还是有更好的方法?
插口
我有一个使用ARC开发的iPhone应用程序.我有一个文件夹,其中包含我需要压缩和发送电子邮件的文档目录中的一堆图像.我的项目使用ARC.
有没有人有任何示例代码/链接到一个对我有帮助的资源?
我一直在网上闲逛,我能找到的东西与ARC不兼容 - 即使它声称是.
我收到以下错误:
错误:无法完成操作.(NSURLErrorDomain错误-1012.)
当我按下"使用Twitter登录"按钮时,控制台中会出现此错误,该按钮是这样创建的(与应用程序中显示的完全相同):
TWTRLogInButton* logInButton = [TWTRLogInButton buttonWithLogInCompletion:^(TWTRSession* session, NSError* error) {
if (session) {
NSLog(@"signed in as %@", [session userName]);
} else {
NSLog(@"error: %@", [error localizedDescription]);
}
}];
Run Code Online (Sandbox Code Playgroud)
我没有看到NSLog的错误或'登录为%@'.
在运行iOS 9.1的iPhone 6S上运行应用程序时发生错误.
Fabric是最新的,版本1.12.0.但是我有以下警告:
模块'TwitterKit'的伞标题不包含标题'TWTRDefines.h'
模块'TwitterKit'的Umbrella标头不包含标题'TWTRSession.h'
我不确定它们是否引起了问题 - 但是它在模拟器和其他设备上运行时持怀疑态度.
在手机上的开发人员设置中,我已将"允许HTTP服务"设置为"开",而在my.plist文件中,我已将"允许任意键"键设置为"是",因为这似乎解决了以前的问题.
任何建议都会受到赞赏,因为我真的迷失了.
我正在尝试使用以下内容访问我的某个页面的DOM元素:
ionViewDidEnter() {
this.platform.ready().then(() => {
let elm = <HTMLElement>document.querySelector("ion-navbar.toolbar.toolbar-ios.statusbar-padding");
console.log(elm.style);
})
}
Run Code Online (Sandbox Code Playgroud)
然而,看起来这个元素没有风格 - 我尝试了各种组合来访问它但没有运气.
具体来说,我正在寻找离子导航栏的高度.这可能吗?
我有这个代码:
- (void) displayView:(int)intNewView{
NSLog(@"%i", intNewView);
[currentView.view removeFromSuperview];
[currentView release];
switch (intNewView) {
case 1:
currentView = [[EnterView alloc] init];
break;
case 2:
currentView = [[MainMenuView alloc] init];
break;
case 3:
currentView = [[DetailsView alloc] init];
break;
case 4:
currentView = [[PhotosView alloc] init];
break;
case 5:
currentView = [[CustomUITableViewViewController alloc] init];
break;
}
[self.view addSubview:currentView.view];
Run Code Online (Sandbox Code Playgroud)
}
这段代码成功地转换了视图,但是它并不像你想象的那样非常壮观(视图只是在没有动画的情况下切换).我想知道是否有一种简单的方法可以在这里添加任何类型的简单视图过渡动画?我无法弄清楚如何实现我在网上找到的任何一个例子.任何动画都足够了,只是为了调整一些东西:)
谢谢,
插口
我有这个代码:
// Fill out the email body text
NSString *emailBody = (@"Name:%@\nNumber of People:\nDate:", name.text);
NSLog(@"%@", emailBody);
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我正在尝试将name.text附加到"Name:"之后的电子邮件正文中.但是,NSLog仅输出name.text中包含的字符串,而不输出电子邮件正文的其余部分.我在这里做错了,代码除了name.text之外还删除了字符串的其余部分?
EG如果name.text包含文本"Jack",则NSLog只输出"Jack"而不是:
Name: Jack
Number of People: x
Date: x
Run Code Online (Sandbox Code Playgroud)
这就是我要找的.
谁能让我了解我做错了什么?
谢谢,
插口
我有一个名为'ProductDatabase.sql'的sqlite数据库,我已将其复制到我的应用程序项目目录中:
/Users/jacknutkins/Documents/TabbedDietApp/TabbedDietApp/ProductDatabase.sql
在应用程序app委托类中,我有这段代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Set-up some globals
m_DatabaseName = @"ProductDatabase.sql";
//Get the path to the documents directory and append the databaseName
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
m_DatabasePath = [documentsDirectory stringByAppendingPathComponent:@"ProductDatabase.sql"];
//Execute the "checkAndCreateDatabase" function
[self checkAndCreateDatabase];
//Query the databse for all animal records and construct the "animals" array
[self readProductsFromDatabase];
....
Run Code Online (Sandbox Code Playgroud)
在此刻:
m_DatabasePath ='/ Users/jacknutkins/Library/Application Support/iPhone Simulator/5.0/Applications/6D5BBE3A-BC9A-4C44-B089-FABA27CFFF4B/Library/ProductDatabase.sql'
以下是其他两种方法的代码:
- (void) checkAndCreateDatabase {
NSError * error;
//Check if the database …Run Code Online (Sandbox Code Playgroud) ios ×9
objective-c ×8
iphone ×7
animation ×1
arrays ×1
compression ×1
core-data ×1
database ×1
email ×1
html ×1
ionic2 ×1
javascript ×1
locking ×1
mfmailcomposeviewcontroller ×1
nsurl ×1
sqlite ×1
storyboard ×1
string ×1
twitter ×1
url ×1
views ×1