我想在我的项目中为所有UIImageViews添加一些圆角.我已经有了代码工作,但我必须将它应用于每个图像; 我应该继承UIImageView来添加它吗?如果是这样,有人可以给我一些指示如何做到这一点?
这是代码
- (void)viewDidLoad {
[super viewDidLoad];
NSString *mainpath = [[NSBundle mainBundle] bundlePath];
welcomeImageView.image = [UIImage imageWithContentsOfFile:[mainpath stringByAppendingString:@"/test.png"]];
welcomeImageView.layer.cornerRadius = 9.0;
welcomeImageView.layer.masksToBounds = YES;
welcomeImageView.layer.borderColor = [UIColor blackColor].CGColor;
welcomeImageView.layer.borderWidth = 3.0;
CGRect frame = welcomeImageView.frame;
frame.size.width = 100;
frame.size.height = 100;
welcomeImageView.frame = frame;
}
Run Code Online (Sandbox Code Playgroud) 我正在创建一个供个人使用的小型rails应用程序,并希望能够上传excel文件以便以后进行验证并添加到数据库中.我之前使用过csv文件,但这已经变得不切实际了.
有没有人知道使用roo或spreadsheet gem上传文件的教程,向用户显示内容然后添加到数据库(验证后)?我知道这是非常具体的,但我想逐步完成这项工作.
到目前为止,我只是一个'导入'视图:
<% form_for :dump, :url=>{:controller=>"students", :action=>"student_import"}, :html => { :multipart => true } do |f| -%>
Select an Excel File :
<%= f.file_field :excel_file -%>
<%= submit_tag 'Submit' -%>
<% end -%>
Run Code Online (Sandbox Code Playgroud)
但不知道如何在控制器中访问此上传的文件.
任何建议/帮助都会受到欢迎.谢谢
我想在我的iPhone应用程序中创建一个类似于iPad照片应用程序中显示的网格视图.我知道iPhone 3.2 SDK是在NDA下,但是有一个库或框架可用于添加这种功能(非SDK).理想情况下,我想最终开发一个iPad版本的应用程序,其中网格将是3个项目宽的纵向和4个横向,但是暂时我想要2个宽的纵向和3个宽的景观.
我能想到的唯一方法是通过继承UITableView并拥有一个创建2或3项的自定义单元格.然而,这看起来很混乱,我相信有更好的方法.
一个典型的项目将有一个图片,标签和按钮 - 没有太复杂.
谢谢
我创建了一个带有模态视图的应用程序,我可以显示然后解散.有没有一种简单的方法可以知道模态视图何时被解除?一旦模态视图被解除,我想在表中重新加载数据,并且不知道这样做的最佳方式.
谢谢
我正在尝试设置我的应用程序,以便在首次启动时,位于主包中"Populator"文件夹中的一系列文件被复制到文档目录中.
我目前的实施如下:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Populator"];
NSString *folderPath = [documentsDirectory stringByAppendingPathComponent:@"Files"];
NSLog(@"Source Path: %@\n Documents Path: %@ \n Folder Path: %@", sourcePath, documentsDirectory, folderPath);
NSError *error;
[[NSFileManager defaultManager] copyItemAtPath:sourcePath
toPath:folderPath
error:&error];
NSLog(@"Error description-%@ \n", [error localizedDescription]);
NSLog(@"Error reason-%@", [error localizedFailureReason]);
....
return YES;
}
Run Code Online (Sandbox Code Playgroud)
但是,第一次使用以下控制台消息运行时会崩溃(但文件会被复制).下次打开应用程序时,它不会崩溃.
2010-07-13 15:14:26.418 AppName[5201:207] Source Path: /Users/jack/Library/Application Support/iPhone Simulator/3.2/Applications/1076C1FA-60B0-4AC7-8CD4-74F81472DAE6/AppName.app/Populator
Documents Path: /Users/jack/Library/Application Support/iPhone Simulator/3.2/Applications/1076C1FA-60B0-4AC7-8CD4-74F81472DAE6/Documents
Folder Path: /Users/jack/Library/Application Support/iPhone Simulator/3.2/Applications/1076C1FA-60B0-4AC7-8CD4-74F81472DAE6/Documents/Files
2010-07-13 …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,具有多年的模型和课程模型.目前有一个has_and_belongs_to_many关系将这些与courses_years表相关联,但是我想在courses_years表中存储一个额外的字段.
新字段是一个名为"强制"的布尔值.
这样做有简单或好的方法吗?
我已经设法在我的应用程序中实现了一个非常基本的PDF查看器,但是想知道是否可以向PDF添加注释.我查看了SDK文档,但没有找到任何内容.我真的有两个问题:
谢谢.
我正在使用本教程中的代码来解析CSV文件并将内容添加到数据库表中.我如何忽略CSV文件的第一行?控制器代码如下:
def csv_import
@parsed_file=CSV::Reader.parse(params[:dump][:file])
n = 0
@parsed_file.each do |row|
s = Student.new
s.name = row[0]
s.cid = row[1]
s.year_id = find_year_id_from_year_title(row[2])
if s.save
n = n+1
GC.start if n%50==0
end
flash.now[:message] = "CSV Import Successful, #{n} new students added to the database."
end
redirect_to(students_url)
end
Run Code Online (Sandbox Code Playgroud) 我目前正在开展一个教育项目,我想在iPhone应用程序中添加一些PDF阅读功能.我知道可以添加一个UIWebView并在那里显示PDF,但是我想添加显示页码,"下一个","上一个"按钮等的功能.是CGPDFDocument我应该走的方向还是有更好的(即功能更丰富的)库可用吗?我一直在寻找CGPDFDocument的功能,但除了API参考之外没有多少可用.
是否也可以用这个来注释PDF?
谢谢
J.P
我正在开发一个主要由api暴露给各种移动客户端(iOS,Android等)的rails应用程序.该应用程序涉及用户向服务器提交数据(通过api调用),但我想要包括的是将这些数据推送到其他客户端的能力.一般概念类似于消息传递应用程序,我从客户端向服务器提交消息,接收器从服务器推送消息.
我目前唯一知道的方法是不断轮询服务器,但必须有比这更好的技术解决方案.有任何想法吗?
iphone ×5
ios ×2
pdf ×2
annotate ×1
code-reuse ×1
csv ×1
gem ×1
gridview ×1
ios4 ×1
ipad ×1
push ×1
spreadsheet ×1
subclass ×1
uitableview ×1