向UISwitch添加行为(Add behaviour to UISwitch)
我在我的
IOS
应用程序的许多地方使用UISwitch
。 其中一些是库存UISwitch
,其中一些是subclassed
。 事情是在iOS 6
VSiOS 7
的大小变化。 所以我写了这个方法:-(void)layoutSubviews{ if ([[[UIDevice currentDevice]systemVersion]intValue]<7) { self.frame = CGRectMake(self.frame.origin.x-28, self.frame.origin.y, self.frame.size.width, self.frame.size.height); } }
我可以更改每个子类并添加此方法,但我不认为这是正确的方法。 如何设置此类以影响基础
UISwitch
类?I am using
UISwitch
in many places of myIOS
app. Some of them are stockUISwitch
and some of them aresubclassed
. The thing is iniOS 6
VSiOS 7
the size changes. So I wrote this method :-(void)layoutSubviews{ if ([[[UIDevice currentDevice]systemVersion]intValue]<7) { self.frame = CGRectMake(self.frame.origin.x-28, self.frame.origin.y, self.frame.size.width, self.frame.size.height); } }
I can change every subclass and add this method but I don't think this is the wright approach. How can I set this class to effect the base
UISwitch
class?
原文:https://stackoverflow.com/questions/20782200
最满意答案
与property-ref有关,请参阅NHibernate通过session.Load()创建代理,但不能通过Linq或Criteria API创建代理
而不是你问过,但也考虑到代理多对一不允许你进行类型检查,如果你是用户的子类,请参阅http://ayende.com/Blog/archive/2010/01/28/ NHibernate的新特征-无代理associations.aspx
Has to do with property-ref see NHibernate creates proxy via session.Load(), but not via Linq or Criteria API
And not that you asked, but also consider that many-to-one with proxy does not allow you to do type-checking if you subclass User, see http://ayende.com/Blog/archive/2010/01/28/nhibernate-new-feature-no-proxy-associations.aspx
相关问答
更多-
我找到了一个问题的答案。 如果不写任何地方.Not.LazyLoad()并需要获得Comments ,你必须写这个(获取id = 1的用户): var user = session.QueryOver
() .Fetch(u => u.Comments) .Eager .List() .Where(u => u.Id == userId) ... -
我想分享我的方法,也许不是答案...... I.避免取one-to-many (收藏) 在创建任何类型的复杂查询(ICriteria,QueryOver)时,我们应该仅在启动模式上使用(LEFT) JOIN。 即many-to-one (流利的References() ) 。 这导致从分页的角度来看预期的行数(每个根实体总是只有一行) 为了避免集合的1 + N问题(但实际上甚至是多对一的)我们有NHiberante强大的功能: 19.1.5。 使用批量提取 NHibernate可以有效地使用批量提取,也就是 ...
-
对于ValueInjecter解决方案,我建议使用SmartConventionInjection (您需要将代码从链接页面复制到您的解决方案中) 并指定了一个不会触及代理属性的约定 这是一个开始: public class MapPoco: SmartConventionInjection { protected override bool Match(SmartConventionInfo c) { return c.SourceProp.Name == c.Tar ...
-
与property-ref有关,请参阅NHibernate通过session.Load()创建代理,但不能通过Linq或Criteria API创建代理 而不是你问过,但也考虑到代理多对一不允许你进行类型检查,如果你是用户的子类,请参阅http://ayende.com/Blog/archive/2010/01/28/ NHibernate的新特征-无代理associations.aspx Has to do with property-ref see NHibernate creates proxy vi ...
-
List错误是由于List的语义而发生的。 这很麻烦,因为在默认情况下bag也会映射到IList ,但这是由于在.NET框架中缺少具有“bag”语义的集合类型。 在概念上,“袋子”中没有订单,因为物品只是被扔进包里并以任何顺序被移走,并且很容易在包内移动。 然而,一个列表是固有的排序和索引(把它看作是一个带有附加语义的数组,因此每个元素都有唯一的索引值)。 你得到的错误信息表明NHibernate需要一个存储每个元素索引值的列(所以它必须是唯一的,因为它是一个IList ,蚂蚁整数值)。 由于您似乎没有索引 ...
-
注意:这仅适用于Fluent NHibernate下载 #632之后的版本 IOneToManyInstance上有一个名为Key的属性,允许您修改关系中使用的密钥; 在该属性上,有一个PropertyRef方法,应该是您正在寻找的方法。 public class ForeignKeyReferenceConvention : IHasManyConvention { public void Apply(IOneToManyCollectionInstance instance) { ins ...
-
好吧,我最终删除了映射属性,因为即使它很懒,NHibernate有时也会加载它。 我所做的实际上是一个黑客攻击。 我需要来自同一个类的属性的别名,所以我使用了来自另一个属性的映射并将SqlString拆分为' . ',以获得正确的别名。 所有这一切对我来说都很有意义,“解决方法”并不好,但我没有看到任何其他方式。 NHibernate需要知道它正在处理什么属性,分配适当的别名。 因为我没有映射属性,所以无法知道我正在寻找什么别名。 我想我做了很多黑客攻击,只是为了避免引用NHibernate.Spatial ...
-
我注意到你的映射指定Nullable并且没有急切的提取(默认情况下它将被延迟加载)。 因此,如果您确实想要生成您在评论中显示的sql,则无法通过简单的session.Get
()来执行此操作。 即使你改变了映射,它就像这样: References(a => a.Table2).Nullable().Columns("Table2Id").ReadOnly().Fetch.Join; 您很可能最终在输出的sql中使用左外连接。 你可以使用内连接强制获取(没有下载任何额外的NHibernate插 ... -
通过将PropertyRef元素放在Package元素之后,可以解决此错误。
使用Fluent Nhibernate从我的sql数据库中获取图形对象(Fetching a graph object from my sql DB using Fluent Nhibernate)[2021-09-24]
一种选择是将图形Id存储在节点中,并加载图形的所有节点。 一旦所有加载它将使用缓存来获取子节点,而不是执行SQL语句。 public class Graph { .... public virtual Node RootNode {get;set;} } public class Node { .... public virtual Graph Graph {get;set;} public virtual IList Links { get; set; ...相关文章
更多- Memcached add 添加key-value命令(存在不会更新)
- 如何 通过TabPanel的add方法,调用已经存在的panel?
- add more solr core for switch deploy old new replace hot deploy
- solr 添加索引
- Solr添加文档到索引
- Hadoop添加节点datanode
- solr 添加数据
- elasticsearch 添加字段
- sbt添加依赖库
- Java添加图片水印
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。