Visual Studio和CMS?(Visual Studio and CMS?)
我必须使用MS visual studio创建一个MVC asp.net网站,这是我在信息系统学习的最后一年。 我想知道是否可以将代码“连接”到HTML拖放式CMS,而不是使用visual studio的html / css编辑器和mvc项目中自动生成的文件。
基本上,我想在visual studio中编写控制器和模型代码,在一个漂亮的CMS中编写视图代码(HTML),如wordpress或drupal(不一定是那两个)。
请指教!
I have to create an MVC asp.net website using MS visual studio for my final year of study in Information Systems. I want to know if it's possible to sort of "connect" the code to an HTML drag-and-drop CMS, instead of using visual studio's html/css editor and the auto-generated files in the mvc project.
Basically, I want to write the controller and model code in visual studio and the view code (HTML) in a nice CMS such as wordpress or drupal (not necessarily those two).
Please advise!
原文:https://stackoverflow.com/questions/14982185
最满意答案
好的,所以您可能正在将这些数据下载到JSON字典或数组中,因此您最初可以将表和集合视图设置为没有这样的内容:
class ViewController : UIViewController, UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate { // note that I would recommend separating these into extensions on ViewController var htmlResponses = []() override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return htmlResponses.count // htmlResponses is empty at this point } override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return htmlResponses.count // htmlResponses is empty at this point } }
然后,一旦您的数据进入,只需使用所述数据填充
htmlResponses
数组,并分别为表视图和集合视图调用tableView.reloadData()
和collectionView.reloadData()
。即使您不使用数组来存储数据,概念也是一样的。 使用空元素填充视图,并在知道数据已从服务器到达后重新加载它们。
Ok, so you're probably downloading this data into a JSON dictionary or into an array, so you could initially set the table and collection views to have no content like so:
class ViewController : UIViewController, UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate { // note that I would recommend separating these into extensions on ViewController var htmlResponses = []() override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return htmlResponses.count // htmlResponses is empty at this point } override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return htmlResponses.count // htmlResponses is empty at this point } }
Then, once your data comes in, simply populate the
htmlResponses
array with said data and calltableView.reloadData()
andcollectionView.reloadData()
for your table views and collection view respectively.Even if you do not use arrays to store your data, the concept is the same. Use empty elements to populate your views and reload them once you know the data has arrived from the server.
相关问答
更多-
由于您在cellForRow中做了非常多的工作,所以需要时间准备,因此当您滚动时,它无法正常显示 检查以下内容。 ViewController.swift 在视图中加载 添加tableView.rowHeight = UITableViewAutomaticDimension 并替换此方法 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let foo = ...
-
何时使用UICollectionView而不是UITableView?(When to use UICollectionView instead of UITableView?)[2024-02-03]
这取决于要求。 应用程序流程如何确定将哪种类型的UI集成到应用程序中。 人们主要使用UICollectionview来创建具有网格中显示的多个图像的UI类型。 这将使用UITableView具有复杂的逻辑,但是使用UICollectionview ,这将很容易。 当使用UICollectionview ,您不需要通过获取所选项目值来设置带有标签或其他内容的按钮。 你可以简单地获取-(void)collectionView:(UICollectionView *)collectionView didSelec ... -
好的,所以您可能正在将这些数据下载到JSON字典或数组中,因此您最初可以将表和集合视图设置为没有这样的内容: class ViewController : UIViewController, UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate { // note that I would recommend separating these into extensio ...
-
如果您想在按表格视图中的行后按下/呈现新视图,则需要实施tableView:didSelectRowAtIndexPath:method: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Present new view here } didSelectRowAtIndexPath:方法在每次按行时都由表视图调用。 您可以使用它来处理行按事件,或者您可以 ...
-
Facebook feed确实是一个UICollectionView,这主要是为了它提供的灵活性。 通过我们的自定义布局,我们可以相当干净地移动/动画单元格。 您可以尝试使用UITableView,但它需要一些我们宁愿避免的大量黑客攻击。 当我们从UITableView迁移到UICollectionView时,我们也注意到了滚动性能的上升。 不幸的是,我一直无法确定更快的确切呼叫。 Facebook feed is indeed a UICollectionView and this is mostly f ...
-
有类似的问题。 在分段控制结束后,滚动回滚到波涛汹涌。 问题可能是初始化。 首先检查你是否正确使用了“dequeueReusableCellWithIdentifier”(可能你错过了给你的自定义单元格一个唯一的ID?) 其次检查你是否每次都在cellForRowAtIndexPath中执行removeAllSegments和insertSegmentWithTitle。 将一些int添加到您的自定义单元格中,告诉您它是否是新的单元格或具有特定数量段的重用单元格。 然后,在“dequeueReusableC ...
-
我弄清楚发生了什么事。 绑定数据时,我错误地重新调整了表视图单元格的大小。 我最终在故事板中使用了新的原型单元,而不是尝试创建一个单独的笔尖。 I figured out what was going on. I was incorrectly re-sizing the table view cell when binding the data. I ended up using the new prototype cells in the storyboard instead of trying to ...
-
我应该使用UITableView或UICollectionView来创建它(Should I use a UITableView or UICollectionView to create this)[2023-11-20]
表视图仅执行单个垂直单元列表。 如果您需要包含行和列的网格,则需要一个集合视图。 如果AG行的3个部分是单个项目的单独部分,那么您可以使用表格视图。 (假设左栏包含图像,中间栏包含标题和副标题,右栏包含项目的说明。) Table views only do a single vertical list of cells. If you need a grid with rows and columns then you need a collection view. If the 3 parts of yo ... -
这样做, -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { switch (sgmtControl.selectedSegmentIndex) { case 0: ...
-
您必须在cellForItemAt重新加载UITableView ,如下所述。 func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TableCollectionCell", for ...